Example #1
0
        public void IsAnalyticsNodeSsl_Is_True_When_Port_Is_Provided()
        {
            var node    = new Node();
            var nodeExt = new NodesExt
            {
                Hostname = "localhost",
                Services = { CbasSsl = 18095 }
            };

            var mockBucketConfig = new Mock <BucketConfig>();
            var adapater         = new NodeAdapter(node, nodeExt, mockBucketConfig.Object);

            Assert.Equal(18095, adapater.AnalyticsSsl);
            Assert.True(adapater.IsAnalyticsNode);
        }
Example #2
0
        public void When_Node_is_null_Kv_service_should_be_disabled()
        {
            const string hostname = "localhost";
            var          nodeExt  = new NodesExt
            {
                Hostname = hostname,
                Services = new Couchbase.Core.Configuration.Server.Services
                {
                    Kv = 11210 // nodeEXt has KV port, but node is null
                }
            };

            var adapter = new NodeAdapter(null, nodeExt, new BucketConfig());

            Assert.Equal(adapter.Hostname, hostname);
            Assert.False(adapter.IsKvNode);
        }
 public static HostEndpointWithPort Create(NodesExt nodeExt, ClusterOptions options)
 {
     return(new HostEndpointWithPort(nodeExt.Hostname,
                                     options.EffectiveEnableTls ? nodeExt.Services.KvSsl : nodeExt.Services.Kv));
 }
 public static Uri GetViewsUri(this IPEndPoint endPoint, Configuration configuration, NodesExt nodesExt)
 {
     if (nodesExt.services.capi == 0)
     {
         return(new UriBuilder
         {
             Scheme = configuration.UseSsl ? Https : Http,
             Host = nodesExt.hostname,
         }.Uri);
     }
     return(new UriBuilder
     {
         Scheme = configuration.UseSsl ? Https : Http,
         Host = nodesExt.hostname,
         Port = configuration.UseSsl ? nodesExt.services.capiSSL : nodesExt.services.capi,
     }.Uri);
 }
 public static Uri GetAnalyticsUri(this IPEndPoint endPoint, Configuration configuration, NodesExt nodesExt)
 {
     if (nodesExt.services.cbas == 0)
     {
         return(new UriBuilder
         {
             Scheme = configuration.UseSsl ? Https : Http,
             Host = nodesExt.hostname,
         }.Uri);
     }
     return(new UriBuilder
     {
         Scheme = configuration.UseSsl ? Https : Http,
         Host = nodesExt.hostname,
         Port = configuration.UseSsl ? nodesExt.services.cbasSSL : nodesExt.services.cbas,
         Path = AnalyticsPath
     }.Uri);
 }
 public static Uri GetQueryUri(this IPEndPoint endPoint, Configuration configuration, NodesExt nodesExt)
 {
     if (nodesExt.services.n1ql == 0)
     {
         return(new UriBuilder
         {
             Scheme = configuration.UseSsl ? Https : Http,
             Host = nodesExt.hostname,
         }.Uri);
     }
     return(new UriBuilder
     {
         Scheme = configuration.UseSsl ? Https : Http,
         Host = nodesExt.hostname,
         Port = configuration.UseSsl ? nodesExt.services.n1qlSSL : nodesExt.services.n1ql,
         Path = QueryPath
     }.Uri);
 }