Example #1
0
        public virtual void testStopStart()
        {
            hf = new HotFolder(theHF, null, new MyListener(true));
            FileInfo file = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsFalse(file.Exists, "First delete attempt.");
            hf.Stop();
            hf.Stop();
            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            hf.restart();
            hf.restart();
            hf.restart();
            StatusCounter.sleep(5000);
            file.Refresh();
            Assert.IsFalse(file.Exists, "Second delete attempt.");
        }
Example #2
0
 public virtual void testRestartMany()
 {
     hf = new HotFolder(theHF, null, new MyListener(true));
     for (int i = 0; i < 10; i++)
     {
         // Java to C# Conversion - TODO: What is .NET Equivalent to activeCount()?
         //Assert.AreEqual(3, Thread.activeCount());
         hf.restart();
     }
     for (int i = 0; i < 3; i++)
     {
         Thread.Sleep(1);
         hf.Stop();
         // Java to C# Conversion - TODO: What is .NET Equivalent to activeCount()?
         //Assert.AreEqual(2, Thread.activeCount());
     }
 }
Example #3
0
 ///
 ///     <summary> * restart this hot folder, create s a new listner thread and stops the old one
 ///     * </summary>
 ///
 public virtual void restart()
 {
     hf.restart();
 }