Exemple #1
0
        public void SimpleQuery_Mixed_MultiThreaded(int threadCount)
        {
            var client = new ReportsServiceClient();

            var columns = client.GetSelectableColumns(this.platform, 1, null, null);

            var request1 = new SearchRequest()
            {
                SelectedColumns     = columns.Data.Take(30).Select(x => new SelectedColumn(x.Id)).ToList(),
                TemporalAggregation = TemporalAggregation.Total,
                PageSize            = 100,
                SortByColumn        = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GroupByColumn       = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GetCount            = true,
            };

            var request2 = new SearchRequest()
            {
                SelectedColumns     = columns.Data.Take(30).Select(x => new SelectedColumn(x.Id)).ToList(),
                TemporalAggregation = TemporalAggregation.Total,
                PageSize            = 100,
                SortByColumn        = columns.Data.Where(x => x.UniqueName == "Campaign_CurrencyCode").Select(x => new SelectedColumn(x.Id)).First(),
                GroupByColumn       = columns.Data.Where(x => x.UniqueName == "Campaign_CurrencyCode").Select(x => new SelectedColumn(x.Id)).First(),
                GetCount            = true,
                Filters             = new List <SearchRequestFilter>()
                {
                    new SearchRequestFilter()
                    {
                        ColumnId = columns.Data.First(x => x.UniqueName.EndsWith("UIStatus")).Id,
                        Values   = new List <string> {
                            "1"
                        }
                    }
                }
            };

            Parallel.For(0, threadCount, x =>
            {
                var result1 = client.Search(this.platform, 1, null, request1);
                Assert.IsNotNull(result1);
                Assert.IsNotNull(result1.Data);
                Assert.GreaterOrEqual(result1.Data.Count, 1);
                Console.WriteLine("{0} rows returned", result1.Data.Count);


                var result2 = client.Search(this.platform, 1, null, request2);
                Assert.IsNotNull(result2);
                Assert.IsNotNull(result2.Data);
                Assert.GreaterOrEqual(result2.Data.Count, 1);
                Console.WriteLine("{0} rows returned", result2.Data.Count);
                Assert.LessOrEqual(result2.Data.Count, 5); // assume we wont ever have > 5 currencies
            });
        }
Exemple #2
0
        public void SimpleQuery_MultiThreaded(int threadCount)
        {
            var client = new ReportsServiceClient();

            var columns = client.GetSelectableColumns(this.platform, 1, null, null);

            var request = new SearchRequest()
            {
                SelectedColumns     = columns.Data.Take(30).Select(x => new SelectedColumn(x.Id)).ToList(),
                TemporalAggregation = TemporalAggregation.Total,
                PageSize            = 100,
                SortByColumn        = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GroupByColumn       = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GetCount            = true,
            };

            Parallel.For(0, threadCount, x =>
            {
                var result = client.Search(this.platform, 1, null, request);

                Assert.IsNotNull(result);
                Assert.IsNotNull(result.Data);
                Assert.GreaterOrEqual(result.Data.Count, 1);

                Console.WriteLine("{0} rows returned", result.Data.Count);
            });
        }
Exemple #3
0
        public void SimpleQuery()
        {
            var client = new ReportsServiceClient();

            var columns = client.GetSelectableColumns(this.platform, 1, null, null);

            var request = new SearchRequest()
            {
                SelectedColumns     = columns.Data.Take(30).Select(x => new SelectedColumn(x.Id)).ToList(),
                TemporalAggregation = TemporalAggregation.Total,
                PageSize            = 100,
                SortByColumn        = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GroupByColumn       = columns.Data.Where(x => x.UniqueName == "CampaignID").Select(x => new SelectedColumn(x.Id)).First(),
                GetCount            = true,
            };

            client.RequestHeaders = new List <RequestHeader>
            {
                new RequestHeader()
                {
                    Name = "x-correlation-id", Value = Guid.NewGuid().ToString()
                },
                new RequestHeader()
                {
                    Name = "x-requesting-component", Value = "Tests"
                }
            };

            var result = client.Search(this.platform, 1, null, request);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Data);
            Assert.GreaterOrEqual(result.Data.Count, 1);

            Console.WriteLine("{0} rows returned", result.Data.Count);
        }