コード例 #1
0
        public void When_UseSsl_Is_True_RawUri_Returns_Https()
        {
            const string expected = "https://localhost:18092/default/_design/testdoc/_spatial/testview?";
            var query = new SpatialViewQuery().From("testdoc", "testview");
            query.UseSsl = true;

            Assert.AreEqual(expected, query.RawUri().ToString());
        }
コード例 #2
0
        public void When_QueryParams_Are_Set_RawUri_Adds_Them_To_Uri()
        {
            const string queryParams = @"/travel-sample/_design/spatial/_spatial/routes?stale=false&connection_timeout=60000&limit=10&skip=0";

            var query = new SpatialViewQuery().From("spatial", "routes")
                .Bucket("travel-sample")
                .Stale(StaleState.False)
                .ConnectionTimeout(60000)
                .Limit(10)
                .Skip(0);
            var uri = query.RawUri();
            Assert.AreEqual(queryParams, uri.PathAndQuery);
        }
コード例 #3
0
        public void When_StartRange_And_EndRange_Are_Set_They_Are_Added_To_Uri()
        {
            const string queryParams = @"/travel-sample/_design/spatial/_spatial/routes?stale=false&connection_timeout=60000&limit=10&skip=0&start_range=[null,null,10000.0]&end_range=[null,null,null]";

            var query = new SpatialViewQuery().From("spatial", "routes")
                .Bucket("travel-sample")
                .Stale(StaleState.False)
                .ConnectionTimeout(60000)
                .StartRange(new List<double?>{null, null, 10000})
                .EndRange(new List<double?>{null, null, null})
                .Limit(10)
                .Skip(0);
            var uri = query.RawUri();
            Assert.AreEqual(queryParams, uri.PathAndQuery);
        }
        public void When_Geometry_Is_Emitted_By_Map_Function_Geometry_Is_Not_Null()
        {
            using (var cluster = new Cluster(ClientConfigUtil.GetConfiguration()))
            {
                using (var bucket = cluster.OpenBucket("beer-sample"))
                {
                    var query = new SpatialViewQuery().From("beer_ext_spatial", "points")
                         .Stale(StaleState.False)
                         .ConnectionTimeout(60000)
                         .Limit(1)
                         .Skip(0);

                    var result = bucket.Query<dynamic>(query);
                    Assert.IsNotNull(result.Rows.First().Geometry);
                }
            }
        }
        public void Test()
        {
            using (var cluster = new Cluster(ClientConfigUtil.GetConfiguration()))
            {
                using (var bucket = cluster.OpenBucket("travel-sample"))
                {
                    var query = new SpatialViewQuery().From("spatial", "routes")
                         .Bucket("travel-sample")
                         .Stale(StaleState.False)
                         .ConnectionTimeout(60000)
                         .Limit(10)
                         .Skip(0);

                    var result = bucket.Query<dynamic>(query);
                }
            }
        }
        public void When_BoundaryBox_Is_Provided_Results_Are_Constrained_By_it()
        {
            using (var cluster = new Cluster(ClientConfigUtil.GetConfiguration()))
            {
                using (var bucket = cluster.OpenBucket("beer-sample"))
                {
                    var query = new SpatialViewQuery().From("beer_ext_spatial", "points")
                         .Stale(StaleState.False)
                         .StartRange(-10.37109375, 33.578014746143985)
                         .EndRange(43.76953125, 71.9653876991313)
                         .ConnectionTimeout(60000)
                         .Limit(1)
                         .Skip(0);

                    var result = bucket.Query<dynamic>(query);
                    Assert.AreEqual(1, result.Rows.Count());
                }
            }
        }
コード例 #7
0
        public void Test_Geo_Spatial_View()
        {
            //arrange
            var uriString = ClientConfigUtil.GetConfiguration().Servers.First().ToString();
            uriString = uriString.Replace("8091", "8092").Replace("pools", "travel-sample/");

            var query = new SpatialViewQuery().From("spatial", "routes")
                .Bucket("travel-sample")
                .Stale(StaleState.False)
                .Limit(10)
                .Skip(0)
                .BaseUri(new Uri(uriString));

            var client = GetViewClient("travel-sample");

            //act
            var results = client.Execute<dynamic>(query);

            //assert
            Assert.IsTrue(results.Success, results.Error);
        }
コード例 #8
0
        public void When_IBucket_Executes_Query_Uri_Is_Properly_Formed()
        {
            using (var cluster = new Cluster(ClientConfigUtil.GetConfiguration()))
            {
                using (var bucket = cluster.OpenBucket("travel-sample"))
                {
                    var query = new SpatialViewQuery().From("spatial", "routes")
                         .Bucket("travel-sample")
                         .Stale(StaleState.False)
                         .ConnectionTimeout(60000)
                         .Limit(10)
                         .Skip(0);

                    var result = bucket.Query<dynamic>(query);
                    var uri = query.RawUri();

                    var expected =
                        "/travel-sample/_design/spatial/_spatial/routes?stale=false&connection_timeout=60000&limit=10&skip=0";
                    Assert.AreEqual(expected, uri.PathAndQuery);
                }
            }
        }
コード例 #9
0
 public void Test_RawUri()
 {
     const string expected = "http://localhost:8092/default/_design/testdoc/_spatial/testview?";
     var query = new SpatialViewQuery().From("testdoc", "testview");
     Assert.AreEqual(expected, query.RawUri().ToString());
 }
コード例 #10
0
        public void Test_Geo_Spatial_View()
        {
            var query = new SpatialViewQuery().From("spatial", "routes")
                .BaseUri(ClientConfigUtil.GetConfiguration().Servers.First().ToString())
                .Bucket("travel-sample")
                .Stale(StaleState.False)
                .Limit(10)
                .Skip(0);

             var client = new ViewClient(new HttpClient(),
                new JsonDataMapper(ClientConfigUtil.GetConfiguration()),
                new BucketConfig { Name = "travel-sample" },
                new ClientConfiguration());

            var results = client.Execute<dynamic>(query);
            Assert.IsTrue(results.Success, results.Error);

        }