Package rx.functions

Examples of rx.functions.Action0


                // the line of the producer
                state.buffer.sendAllNotifications(subscriber);

                // register real observer for pass-thru ... and drain any further events received on first notification
                state.setObserverRef(new PassThruObserver<T>(subscriber, state));
                subscriber.add(Subscriptions.create(new Action0() {
                    @Override
                    public void call() {
                        if (null != state.onUnsubscribe) {
                            state.onUnsubscribe.call();
                        }
View Full Code Here


      new Action1<Throwable>() {
        public void call(Throwable t) {
          rx.onError(t);
        }
      },
      new Action0() {
        public void call() {
          rx.onNext(total.get());
          rx.onCompleted();
        }
      }
View Full Code Here

        public void call(Throwable t) {
          target.clear();
          rx.onError(t);
        }
      },
      new Action0() {
        public void call() {
          target.complete(new Handler<Void>() {
            public void handle(Void event) {
              rx.onCompleted();
            }
View Full Code Here

    Observable<Long> ob=timer.setPeriodic(50).take(3);

    final long startTime=System.currentTimeMillis();

    // Expect 3 values
    final Subscription sub=assertCountThen(ob,new Action0() {
      public void call() {
        long totalTime=System.currentTimeMillis()-startTime;
        System.out.println("Test complete after "+(totalTime)+"ms");
        // Ensure the total time is withing 20% of the expected value
        assertTrue("Time within 20% of expected",Math.abs((totalTime/(50*3))-1)<0.2);
 
View Full Code Here

      new Action1<Throwable>() {
        public void call(Throwable t) {
          fail("Error while mapping message (t="+t+")");
        }
      },
      new Action0() {
        public void call() {
          assertEquals(0,count.get());
          testComplete();
        }
      });
View Full Code Here

    assertSequence(in,value);
  }

  /** Assert a sequence */
  public static <T> void assertSequence(Observable<T> in, final T... exp) {
    assertSequenceThen(in, new Action0() {
      @Override public void call() {
        // Do nothing
      }
    }, exp);
  }
View Full Code Here

    }, exp);
  }

  /** Assert that we receive N values */
  public static <T> Subscription assertCount(Observable<T> in, final int max) {
    return assertCountThen(in,new Action0() {
      @Override public void call() {
      }
    },max);
  }
View Full Code Here

    },max);
  }

  /** Assert that we receive N values then complete test */
  public static <T> Subscription assertCountThenComplete(Observable<T> in, final int max) {
    return assertCountThen(in,new Action0() {
      @Override public void call() {
        testComplete();
      }
    },max);
  }
View Full Code Here

      new Action1<Throwable>() {
        public void call(Throwable t) {
          fail("Error while counting sequence (t="+t+")");
        }
      },
      new Action0() {
        public void call() {
          assertTrue(count.get()==max);
          System.out.println("sequence-complete");
          thenAction.call();
        }
View Full Code Here

    assertSequenceThenComplete(in,value);
  }

  /** Assert a sequence then complete test */
  public static <T> void assertSequenceThenComplete(Observable<T> in, final T... exp) {
    assertSequenceThen(in, new Action0() {
      @Override public void call() {
        testComplete();
      }
    }, exp);
  }
View Full Code Here

TOP

Related Classes of rx.functions.Action0

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.