Exemple #1
0
 public UserManager(IServiceUriProvider serviceUriProvider, CouchbaseHttpClient httpClient,
                    ILogger <UserManager> logger)
 {
     _serviceUriProvider = serviceUriProvider ?? throw new ArgumentNullException(nameof(serviceUriProvider));
     _client             = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #2
0
        public async Task SearchQueriesUseCorrectPath()
        {
            const string indexName = "test-index";

            using var handler = FakeHttpMessageHandler.Create((req) =>
            {
                Assert.Equal("http://localhost:8094/api/index/test-index/query", req.RequestUri.ToString());
                return(new HttpResponseMessage
                {
                    Content = new StreamContent(new MemoryStream())
                });
            });
            var httpClient = new CouchbaseHttpClient(handler);

            var mockServiceUriProvider = new Mock <IServiceUriProvider>();

            mockServiceUriProvider
            .Setup(m => m.GetRandomSearchUri())
            .Returns(new Uri("http://localhost:8094"));

            var client = new SearchClient(httpClient, mockServiceUriProvider.Object,
                                          new Mock <ILogger <SearchClient> >().Object, NoopRequestTracer.Instance);

            await client.QueryAsync(new SearchRequest { Index = indexName, Options = new SearchOptions() }).ConfigureAwait(false);
        }
 public EventingFunctionService(CouchbaseHttpClient httpClient, IServiceUriProvider serviceUriProvider,
                                ILogger <EventingFunctionService> logger, IRedactor redactor)
     : base(httpClient)
 {
     _serviceUriProvider = serviceUriProvider;
     _logger             = logger;
     _redactor           = redactor;
 }
Exemple #4
0
 public ViewIndexManager(string bucketName, IServiceUriProvider serviceUriProvider, CouchbaseHttpClient httpClient,
                         ILogger <ViewIndexManager> logger, IRedactor redactor)
 {
     _bucketName         = bucketName ?? throw new ArgumentNullException(nameof(bucketName));
     _serviceUriProvider = serviceUriProvider ?? throw new ArgumentNullException(nameof(serviceUriProvider));
     _client             = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _redactor           = redactor ?? throw new ArgumentNullException(nameof(redactor));
 }
 public QueryClient(
     CouchbaseHttpClient httpClient,
     IServiceUriProvider serviceUriProvider,
     ITypeSerializer serializer,
     ILogger <QueryClient> logger,
     IRequestTracer tracer)
     : base(httpClient)
 {
     _serviceUriProvider = serviceUriProvider ?? throw new ArgumentNullException(nameof(serviceUriProvider));
     _serializer         = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _tracer             = tracer ?? throw new ArgumentNullException(nameof(tracer));
     HttpClient.Timeout  = Timeout.InfiniteTimeSpan;
 }
Exemple #6
0
        internal CouchbaseBucket(string name, ClusterOptions clusterOptions, ConfigContext couchbaseContext)
        {
            Name             = name;
            CouchbaseContext = couchbaseContext;
            ClusterOptions   = clusterOptions;
            CouchbaseContext.Subscribe(this);

            var httpClient = new CouchbaseHttpClient(ClusterOptions);

            _viewClientLazy = new Lazy <IViewClient>(() =>
                                                     new ViewClient(httpClient, new JsonDataMapper(new DefaultSerializer()), ClusterOptions)
                                                     );
            _viewManagerLazy = new Lazy <IViewManager>(() =>
                                                       new ViewManager(name, httpClient, clusterOptions));
        }