/** * The returned {@link RxTransaction} allows DB transactions using Rx Observables without any Scheduler set for * subscribeOn. * * @see #rxTx() */ @Experimental public RxTransaction rxTxPlain() { if (rxTxPlain == null) { rxTxPlain = new RxTransaction(this); } return rxTxPlain; }
/** * Rx version of {@link AbstractDaoSession#callInTx(Callable)} returning an Observable. */ @Experimental public <T> Observable<T> call(final Callable<T> callable) { return wrap(new Callable<T>() { @Override public T call() throws Exception { return daoSession.callInTx(callable); } }); }
public void testRun() { Observable<Void> observable = rxTx.run(new Runnable() { @Override public void run() { TestEntity entity = insertEntity("hello"); entity.setSimpleString("world"); daoSession.update(entity); } }); TestSubscriber<Void> testSubscriber = assertTxExecuted(observable); assertNull(testSubscriber.getOnNextEvents().get(0)); }
public void testCall(RxTransaction rxTx) { Observable<String> observable = rxTx.call(new Callable<String>() { @Override public String call() { TestEntity entity = insertEntity("hello"); entity.setSimpleString("world"); daoSession.update(entity); return "Just checking"; } }); TestSubscriber<String> testSubscriber = assertTxExecuted(observable); assertEquals("Just checking", testSubscriber.getOnNextEvents().get(0)); }
/** * Rx version of {@link AbstractDaoSession#runInTx(Runnable)} returning an Observable. */ @Experimental public Observable<Void> run(final Runnable runnable) { return wrap(new Callable<Void>() { @Override public Void call() throws Exception { daoSession.runInTx(runnable); return null; } }); }
/** * The returned {@link RxTransaction} allows DB transactions using Rx Observables using RX's IO scheduler for * subscribeOn. * * @see #rxTxPlain() */ @Experimental public RxTransaction rxTx() { if (rxTxIo == null) { rxTxIo = new RxTransaction(this, Schedulers.io()); } return rxTxIo; }
/** * Rx version of {@link AbstractDaoSession#callInTx(Callable)} returning an Observable. */ @Experimental public <T> Observable<T> call(final Callable<T> callable) { return wrap(new Callable<T>() { @Override public T call() throws Exception { return daoSession.callInTx(callable); } }); }
/** * The returned {@link RxTransaction} allows DB transactions using Rx Observables without any Scheduler set for * subscribeOn. * * @see #rxTx() */ @Experimental public RxTransaction rxTxPlain() { if (rxTxPlain == null) { rxTxPlain = new RxTransaction(this); } return rxTxPlain; }
/** * Rx version of {@link AbstractDaoSession#runInTx(Runnable)} returning an Observable. */ @Experimental public Observable<Void> run(final Runnable runnable) { return wrap(new Callable<Void>() { @Override public Void call() throws Exception { daoSession.runInTx(runnable); return null; } }); }
/** * The returned {@link RxTransaction} allows DB transactions using Rx Observables using RX's IO scheduler for * subscribeOn. * * @see #rxTxPlain() */ @Experimental public RxTransaction rxTx() { if (rxTxIo == null) { rxTxIo = new RxTransaction(this, Schedulers.io()); } return rxTxIo; }