rx.lang.scala

schedulers

package schedulers

Visibility
  1. Public
  2. All

Type Members

  1. class ComputationScheduler extends Scheduler

  2. class ExecutionContextScheduler extends Scheduler

  3. class IOScheduler extends Scheduler

  4. class ImmediateScheduler extends Scheduler

  5. class NewThreadScheduler extends Scheduler

  6. class TestScheduler extends Scheduler

    Scheduler with artificial time, useful for testing.

    Scheduler with artificial time, useful for testing.

    For example, you could test the Observable.interval operation using a TestScheduler as follows:

    @Test def testInterval() {
      import org.mockito.Matchers._
      import org.mockito.Mockito._
      import rx.lang.scala.JavaConversions._
    
      val scheduler = TestScheduler()
      val observer = mock(classOf[rx.Observer[Long]])
    
      val o = Observable.interval(1 second, scheduler)
      val sub = o.subscribe(toScalaObserver(new TestObserver(observer)))
    
      verify(observer, never).onNext(0L)
      verify(observer, never).onCompleted()
      verify(observer, never).onError(any(classOf[Throwable]))
    
      scheduler.advanceTimeTo(2 seconds)
    
      val inOrdr = inOrder(observer);
      inOrdr.verify(observer, times(1)).onNext(0L)
      inOrdr.verify(observer, times(1)).onNext(1L)
      inOrdr.verify(observer, never).onNext(2L)
      verify(observer, never).onCompleted()
      verify(observer, never).onError(any(classOf[Throwable]))
    
      sub.unsubscribe();
      scheduler.advanceTimeTo(4 seconds)
      verify(observer, never).onNext(2L)
      verify(observer, times(1)).onCompleted()
      verify(observer, never).onError(any(classOf[Throwable]))
    }
  7. class TrampolineScheduler extends Scheduler

Value Members

  1. object ComputationScheduler

  2. object ExecutionContextScheduler

  3. object IOScheduler

  4. object ImmediateScheduler

  5. object NewThreadScheduler

  6. object TestScheduler

    Provides constructors for TestScheduler.

  7. object TrampolineScheduler

Ungrouped