示例#1
0
 public override void Run()
 {
     try
     {
         wldt.DoLogic();
     }
     catch (Exception e)
     {
         throw new Exception(e.ToString(), e);
     }
 }
示例#2
0
 public override void Run()
 {
     try
     {
         wldt.DoLogic();
     }
     catch (Exception e) when(e.IsException())
     {
         throw RuntimeException.Create(e);
     }
 }
        public void TestEmptyTitle()
        {
            FileInfo         file    = new FileInfo(Path.Combine(getWorkDir().FullName, "one-line"));
            PerfRunData      runData = createPerfRunData(file, false, typeof(NoTitleDocMaker).AssemblyQualifiedName);
            WriteLineDocTask wldt    = new WriteLineDocTask(runData);

            wldt.DoLogic();
            wldt.Dispose();


            doReadTest(file, FileType.PLAIN, "", "date", "body");
        }
        public void TestRegularFile()
        {
            // Create a document in regular format.
            FileInfo         file    = new FileInfo(Path.Combine(getWorkDir().FullName, "one-line"));
            PerfRunData      runData = createPerfRunData(file, false, typeof(WriteLineDocMaker).AssemblyQualifiedName);
            WriteLineDocTask wldt    = new WriteLineDocTask(runData);

            wldt.DoLogic();
            wldt.Dispose();


            doReadTest(file, FileType.PLAIN, "title", "date", "body");
        }
        public void TestEmptyBody()
        {
            // WriteLineDocTask threw away documents w/ no BODY element, even if they
            // had a TITLE element (LUCENE-1755). It should throw away documents if they
            // don't have BODY nor TITLE
            FileInfo         file    = new FileInfo(Path.Combine(getWorkDir().FullName, "one-line"));
            PerfRunData      runData = createPerfRunData(file, false, typeof(NoBodyDocMaker).AssemblyQualifiedName);
            WriteLineDocTask wldt    = new WriteLineDocTask(runData);

            wldt.DoLogic();
            wldt.Dispose();


            doReadTest(file, FileType.PLAIN, "title", "date", null);
        }
        public void TestCharsReplace()
        {
            // WriteLineDocTask replaced only \t characters w/ a space, since that's its
            // separator char. However, it didn't replace newline characters, which
            // resulted in errors in LineDocSource.
            FileInfo         file    = new FileInfo(Path.Combine(getWorkDir().FullName, "one-line"));
            PerfRunData      runData = createPerfRunData(file, false, typeof(NewLinesDocMaker).AssemblyQualifiedName);
            WriteLineDocTask wldt    = new WriteLineDocTask(runData);

            wldt.DoLogic();
            wldt.Dispose();


            doReadTest(file, FileType.PLAIN, "title text", "date text", "body text two");
        }
        public void TestEmptyDoc()
        {
            FileInfo         file    = new FileInfo(Path.Combine(getWorkDir().FullName, "one-line"));
            PerfRunData      runData = createPerfRunData(file, true, typeof(EmptyDocMaker).AssemblyQualifiedName);
            WriteLineDocTask wldt    = new WriteLineDocTask(runData);

            wldt.DoLogic();
            wldt.Dispose();

            TextReader br = new StreamReader(new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);

            try
            {
                String line = br.ReadLine();
                assertHeaderLine(line);
                line = br.ReadLine();
                assertNotNull(line);
            }
            finally
            {
                br.Dispose();
            }
        }