AssertIndexEquals() public static method

public static AssertIndexEquals ( DirectoryReader index1, DirectoryReader index2 ) : void
index1 DirectoryReader
index2 DirectoryReader
return void
コード例 #1
0
        private void PerformDefaultTests(TestReopen test)
        {
            DirectoryReader index1 = test.OpenReader();
            DirectoryReader index2 = test.OpenReader();

            TestDirectoryReader.AssertIndexEquals(index1, index2);

            // verify that reopen() does not return a new reader instance
            // in case the index has no changes
            ReaderCouple couple = RefreshReader(index2, false);

            Assert.IsTrue(couple.RefreshedReader == index2);

            couple = RefreshReader(index2, test, 0, true);
            index1.Dispose();
            index1 = couple.NewReader;

            DirectoryReader index2_refreshed = couple.RefreshedReader;

            index2.Dispose();

            // test if refreshed reader and newly opened reader return equal results
            TestDirectoryReader.AssertIndexEquals(index1, index2_refreshed);

            index2_refreshed.Dispose();
            AssertReaderClosed(index2, true);
            AssertReaderClosed(index2_refreshed, true);

            index2 = test.OpenReader();

            for (int i = 1; i < 4; i++)
            {
                index1.Dispose();
                couple = RefreshReader(index2, test, i, true);
                // refresh DirectoryReader
                index2.Dispose();

                index2 = couple.RefreshedReader;
                index1 = couple.NewReader;
                TestDirectoryReader.AssertIndexEquals(index1, index2);
            }

            index1.Dispose();
            index2.Dispose();
            AssertReaderClosed(index1, true);
            AssertReaderClosed(index2, true);
        }
コード例 #2
0
            public override void Run()
            {
                Random rnd = LuceneTestCase.Random();

                while (!Stopped)
                {
                    int numReaders = Readers.Count;
                    if (numReaders > 0)
                    {
                        ReaderCouple c = Readers[rnd.Next(numReaders)];
                        TestDirectoryReader.AssertIndexEquals(c.NewReader, c.RefreshedReader);
                    }

                    lock (this)
                    {
                        Monitor.Wait(this, TimeSpan.FromMilliseconds(TestUtil.NextInt(Random(), 1, 100)));
                    }
                }
            }
コード例 #3
0
            public override void Run()
            {
                Random rnd = LuceneTestCase.Random;

                while (!stopped)
                {
                    int numReaders = readers.Count;
                    if (numReaders > 0)
                    {
                        ReaderCouple c = readers[rnd.Next(numReaders)];
                        TestDirectoryReader.AssertIndexEquals(c.newReader, c.refreshedReader);
                    }

                    UninterruptableMonitor.Enter(this);
                    try
                    {
                        UninterruptableMonitor.Wait(this, TimeSpan.FromMilliseconds(TestUtil.NextInt32(Random, 1, 100)));
                    }
                    finally
                    {
                        UninterruptableMonitor.Exit(this);
                    }
                }
            }