コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotStartForSingleIndexAJobIfTheTrackerCannotHandleIt()
        public virtual void ShouldNotStartForSingleIndexAJobIfTheTrackerCannotHandleIt()
        {
            // given
            IndexSamplingController controller = NewSamplingController(Always(false));

            when(_tracker.canExecuteMoreSamplingJobs()).thenReturn(false);
            when(_indexProxy.State).thenReturn(ONLINE);

            // when
            controller.SampleIndex(_indexId, BACKGROUND_REBUILD_UPDATED);

            // then
            verify(_tracker, times(1)).canExecuteMoreSamplingJobs();
            verifyNoMoreInteractions(_jobFactory, _tracker);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSampleIndex()
        public virtual void ShouldSampleIndex()
        {
            // given
            IndexSamplingController controller = NewSamplingController(Always(false));

            when(_tracker.canExecuteMoreSamplingJobs()).thenReturn(true);
            when(_indexProxy.State).thenReturn(ONLINE);
            when(_anotherIndexProxy.State).thenReturn(ONLINE);
            _indexMap.putIndexProxy(_anotherIndexProxy);

            // when
            controller.SampleIndex(_indexId, TRIGGER_REBUILD_UPDATED);

            // then
            verify(_jobFactory, times(1)).create(_indexId, _indexProxy);
            verify(_tracker, times(1)).scheduleSamplingJob(_job);
            verify(_jobFactory, never()).create(_anotherIndexId, _anotherIndexProxy);
            verify(_tracker, never()).scheduleSamplingJob(_anotherJob);

            verify(_tracker, times(1)).waitUntilCanExecuteMoreSamplingJobs();
            verifyNoMoreInteractions(_jobFactory, _tracker);
        }