Package

rx.lang.scala

schedulers

Permalink

package schedulers

Visibility
  1. Public
  2. All

Type Members

  1. class ComputationScheduler extends Scheduler

    Permalink
  2. class ExecutionContextScheduler extends Scheduler

    Permalink
  3. class IOScheduler extends Scheduler

    Permalink
  4. class ImmediateScheduler extends Scheduler

    Permalink
  5. class NewThreadScheduler extends Scheduler

    Permalink
  6. class TestScheduler extends Scheduler

    Permalink

    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

    Permalink

Value Members

  1. object ComputationScheduler

    Permalink
  2. object ExecutionContextScheduler

    Permalink
  3. object IOScheduler

    Permalink
  4. object ImmediateScheduler

    Permalink
  5. object NewThreadScheduler

    Permalink
  6. object TestScheduler

    Permalink

    Provides constructors for TestScheduler.

  7. object TrampolineScheduler

    Permalink

Ungrouped