示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExitOnErrorInHalt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExitOnErrorInHalt()
        {
            // GIVEN
            PageCache pageCache = mock(typeof(PageCache));
            Exception failure   = new Exception();

            doAnswer(invocation =>
            {
                throw failure;
            }).when(pageCache).flushAndForce();
            PageCacheFlusher flusher = new PageCacheFlusher(pageCache);

            flusher.Run();

            // WHEN
            try
            {
                flusher.Halt();
                fail();
            }
            catch (Exception e)
            {
                // THEN
                assertSame(failure, e);
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = 10_000) public void shouldWaitForCompletionInHalt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWaitForCompletionInHalt()
        {
            // GIVEN
            PageCache pageCache = mock(typeof(PageCache));

            Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control();
            doAnswer(invocation =>
            {
                barrier.Reached();
                return(null);
            }).when(pageCache).flushAndForce();
            PageCacheFlusher flusher = new PageCacheFlusher(pageCache);

            flusher.Start();

            // WHEN
            barrier.Await();
            Future <object> halt = T2.execute(state =>
            {
                flusher.Halt();
                return(null);
            });

            T2.get().waitUntilWaiting(details => details.isAt(typeof(PageCacheFlusher), "halt"));
            barrier.Release();

            // THEN halt call exits normally after (confirmed) ongoing flushAndForce call completed.
            halt.get();
        }
示例#3
0
 public virtual void StopFlushingPageCache()
 {
     if (_importConfiguration.sequentialBackgroundFlushing())
     {
         if (_flusher == null)
         {
             throw new System.InvalidOperationException("Flusher not started");
         }
         _flusher.halt();
         _flusher = null;
     }
 }
示例#4
0
 public virtual void StartFlushingPageCache()
 {
     if (_importConfiguration.sequentialBackgroundFlushing())
     {
         if (_flusher != null)
         {
             throw new System.InvalidOperationException("Flusher already started");
         }
         _flusher = new PageCacheFlusher(_pageCache);
         _flusher.Start();
     }
 }