Exemplo n.º 1
0
            public override void Eval(MockDirectoryWrapper dir)
            {
                // Since we throw exc during abort, eg when IW is
                // attempting to delete files, we will leave
                // leftovers:
                dir.AssertNoUnreferencedFilesOnClose = false;

                if (m_doFail)
                {
                    // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
                    // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
                    bool sawAbortOrFlushDoc = StackTraceHelper.DoesStackTraceContainMethod("Abort") ||
                                              StackTraceHelper.DoesStackTraceContainMethod("FinishDocument");
                    bool sawClose = StackTraceHelper.DoesStackTraceContainMethod("Close") ||
                                    StackTraceHelper.DoesStackTraceContainMethod("Dispose");
                    bool sawMerge = StackTraceHelper.DoesStackTraceContainMethod("Merge");

                    if (sawAbortOrFlushDoc && !sawClose && !sawMerge)
                    {
                        if (OnlyOnce)
                        {
                            m_doFail = false;
                        }
                        //System.out.println(Thread.currentThread().getName() + ": now fail");
                        //new Throwable(Console.WriteLine().StackTrace);
                        throw new IOException("now failing on purpose");
                    }
                }
            }
            public override void Eval(MockDirectoryWrapper dir)
            {
                // Since we throw exc during abort, eg when IW is
                // attempting to delete files, we will leave
                // leftovers:
                dir.AssertNoUnrefencedFilesOnClose = false;

                if (DoFail)
                {
                    bool sawAbortOrFlushDoc = StackTraceHelper.DoesStackTraceContainMethod("Abort") ||
                                              StackTraceHelper.DoesStackTraceContainMethod("FinishDocument");
                    bool sawClose = StackTraceHelper.DoesStackTraceContainMethod("Close") ||
                                    StackTraceHelper.DoesStackTraceContainMethod("Dispose");
                    bool sawMerge = StackTraceHelper.DoesStackTraceContainMethod("Merge");

                    if (sawAbortOrFlushDoc && !sawClose && !sawMerge)
                    {
                        if (OnlyOnce)
                        {
                            DoFail = false;
                        }
                        //System.out.println(Thread.currentThread().getName() + ": now fail");
                        //new Throwable(Console.WriteLine().StackTrace);
                        throw new IOException("now failing on purpose");
                    }
                }
            }
 public override void Eval(MockDirectoryWrapper dir)
 {
     if (StackTraceHelper.DoesStackTraceContainMethod("DoMerge"))
     {
         throw new IOException("now failing during merge");
     }
 }
 public override void Eval(MockDirectoryWrapper dir)
 {
     /*typeof(PersistentSnapshotDeletionPolicy).Name.Equals(frame.GetType().Name) && */
     if (StackTraceHelper.DoesStackTraceContainMethod("Persist"))
     {
         throw new IOException("now fail on purpose");
     }
 }
Exemplo n.º 5
0
 public override void Eval(MockDirectoryWrapper dir)
 {
     // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
     // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
     if (StackTraceHelper.DoesStackTraceContainMethod("DoMerge"))
     {
         throw new IOException("now failing during merge");
     }
 }
 public override void Eval(MockDirectoryWrapper dir)
 {
     // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
     // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
     if (StackTraceHelper.DoesStackTraceContainMethod(typeof(PersistentSnapshotDeletionPolicy).Name, "Persist"))
     {
         throw new IOException("now fail on purpose");
     }
 }
 public override void Eval(MockDirectoryWrapper dir)
 {
     if (DoFail)
     {
         if (StackTraceHelper.DoesStackTraceContainMethod("Flush") /*&& "Lucene.Net.Index.DocFieldProcessor".Equals(frame.GetType().Name)*/)
         {
             if (OnlyOnce)
             {
                 DoFail = false;
             }
             //System.out.println(Thread.currentThread().getName() + ": NOW FAIL: onlyOnce=" + onlyOnce);
             //new Throwable(Console.WriteLine().StackTrace);
             throw new IOException("now failing on purpose");
         }
     }
 }
Exemplo n.º 8
0
 public override void Eval(MockDirectoryWrapper dir)
 {
     if (m_doFail)
     {
         // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
         // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
         if (StackTraceHelper.DoesStackTraceContainMethod(typeof(DocFieldProcessor).Name, "Flush"))
         {
             if (OnlyOnce)
             {
                 m_doFail = false;
             }
             //System.out.println(Thread.currentThread().getName() + ": NOW FAIL: onlyOnce=" + onlyOnce);
             //new Throwable(Console.WriteLine().StackTrace);
             throw new IOException("now failing on purpose");
         }
     }
 }
Exemplo n.º 9
0
            protected internal override bool SortTermsByUnicode()
            {
                // We carefully peek into stack track above us: if
                // we are part of a "merge", we must sort by UTF16:
                bool unicodeSortOrder = true;

                // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
                // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
                if (StackTraceHelper.DoesStackTraceContainMethod("Merge"))
                {
                    unicodeSortOrder = false;
                    if (LuceneTestCase.VERBOSE)
                    {
                        Console.WriteLine("NOTE: PreFlexRW codec: forcing legacy UTF16 vector term sort order");
                    }
                }

                return(unicodeSortOrder);
            }
            public override void Eval(MockDirectoryWrapper dir)
            {
                if (!DoFail)
                {
                    return;
                }

                /*typeof(SegmentMerger).Name.Equals(frame.GetType().Name) && */
                if (StackTraceHelper.DoesStackTraceContainMethod("MergeTerms") && !DidFail1)
                {
                    DidFail1 = true;
                    throw new IOException("fake disk full during mergeTerms");
                }

                /*typeof(LiveDocsFormat).Name.Equals(frame.GetType().Name) && */
                if (StackTraceHelper.DoesStackTraceContainMethod("WriteLiveDocs") && !DidFail2)
                {
                    DidFail2 = true;
                    throw new IOException("fake disk full while writing LiveDocs");
                }
            }
Exemplo n.º 11
0
            public override void Eval(MockDirectoryWrapper dir)
            {
                if (!DoFail)
                {
                    return;
                }

                // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
                // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
                if (StackTraceHelper.DoesStackTraceContainMethod(typeof(SegmentMerger).Name, "MergeTerms") && !DidFail1)
                {
                    DidFail1 = true;
                    throw new IOException("fake disk full during mergeTerms");
                }

                // LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
                // to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
                if (StackTraceHelper.DoesStackTraceContainMethod(typeof(LiveDocsFormat).Name, "WriteLiveDocs") && !DidFail2)
                {
                    DidFail2 = true;
                    throw new IOException("fake disk full while writing LiveDocs");
                }
            }