Java Code Examples for io.reactivex.Observable#concatMap()
The following examples show how to use
io.reactivex.Observable#concatMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotYetSupportedTest.java From brave with Apache License 2.0 | 5 votes |
/** * On XMap (ex {@code just(1).concatMap(..}, the source scalar callable is not passed as an input * to the subsequent operator like {@code ObservableScalarXMap.ScalarXMapObservable}. What is * passed is the result of {@link ScalarCallable#call()}. * * <p>Usually, this would result in lost tracking of the assembled context. However, we use a * thread local to stash the context between {@link ScalarCallable#call()} and the next {@link * RxJavaPlugins#onAssembly assembly hook}. * * @see ObservableScalarXMap#scalarXMap - references to this are operators which require stashing */ @Test(expected = AssertionError.class) public void observable_scalarCallable_propagatesContextOnXMap() { Observable<Integer> fuseable; try (Scope scope1 = currentTraceContext.newScope(assemblyContext)) { fuseable = Observable.just(1); assertThat(fuseable).isInstanceOf(ScalarCallable.class); } // eventhough upstream is assembled with XMap, we still inherit the fused context. fuseable = fuseable.concatMap(Observable::just); assertXMapFusion(fuseable).test().assertValues(1).assertNoErrors(); }
Example 2
Source File: NotYetSupportedTest.java From brave with Apache License 2.0 | 5 votes |
/** * Same as {@link #observable_scalarCallable_propagatesContextOnXMap()}, except for Flowable. * * @see FlowableScalarXMap#scalarXMap - references of this will break when assembly */ @Test(expected = AssertionError.class) public void flowable_scalarCallable_propagatesContextOnXMap() { Observable<Integer> fuseable; try (Scope scope1 = currentTraceContext.newScope(assemblyContext)) { fuseable = Observable.just(1); assertThat(fuseable).isInstanceOf(ScalarCallable.class); } // eventhough upstream is assembled with XMap, we still inherit the fused context. fuseable = fuseable.concatMap(Observable::just); assertXMapFusion(fuseable).test().assertValues(1).assertNoErrors(); }