コード例 #1
0
        public void set_index_priority_through_index_definition()
        {
            using (var store = NewRemoteDocumentStore(fiddler: true))
            {
                var index1 = new SampleIndex1
                {
                    Conventions = new DocumentConvention()
                };
                index1.Execute(store);
                var stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex1");
                Assert.Equal(IndexingPriority.Abandoned, stats.Priority);


                var index2 = new SampleIndex2
                {
                    Conventions = new DocumentConvention()
                };
                index2.Execute(store);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex2");

                Assert.Equal(IndexingPriority.Idle, stats.Priority);



                var index3 = new SampleIndex3
                {
                    Conventions = new DocumentConvention()
                };
                index3.Execute(store);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex3");

                Assert.Equal(IndexingPriority.Disabled, stats.Priority);



                var index4 = new SampleIndex4
                {
                    Conventions = new DocumentConvention()
                };
                index4.Execute(store);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex4");

                Assert.Equal(IndexingPriority.Normal, stats.Priority);
            }
        }
コード例 #2
0
ファイル: RavenDB-3314.cs プロジェクト: yitaom2/ravendb
        public void set_index_priority_through_index_definition()
        {
            using (var store = GetDocumentStore())
            {
                var index1 = new SampleIndex1
                {
                    Conventions = new DocumentConventions()
                };
                index1.Execute(store);

                var stats = store.Maintenance.Send(new GetStatisticsOperation()).Indexes.First(x => x.Name == "SampleIndex1");
                Assert.Equal(IndexPriority.High, stats.Priority);

                var index2 = new SampleIndex2
                {
                    Conventions = new DocumentConventions()
                };
                index2.Execute(store);

                stats = store.Maintenance.Send(new GetStatisticsOperation()).Indexes.First(x => x.Name == "SampleIndex2");
                Assert.Equal(IndexPriority.Low, stats.Priority);

                var index3 = new SampleIndex3
                {
                    Conventions = new DocumentConventions()
                };
                index3.Execute(store);

                stats = store.Maintenance.Send(new GetStatisticsOperation()).Indexes.First(x => x.Name == "SampleIndex3");
                Assert.Equal(IndexPriority.Low, stats.Priority);

                var index4 = new SampleIndex4
                {
                    Conventions = new DocumentConventions()
                };
                index4.Execute(store);

                stats = store.Maintenance.Send(new GetStatisticsOperation()).Indexes.First(x => x.Name == "SampleIndex4");
                Assert.Equal(IndexPriority.Normal, stats.Priority);
            }
        }