Skip to content

Commit 49a138b

Browse files
committed
Test for rx3.io-scheduled-release
1 parent 980d51d commit 49a138b

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright (c) 2016-present, RxJava Contributors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5+
* compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is
10+
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11+
* the License for the specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package io.reactivex.rxjava3.schedulers;
15+
16+
import io.reactivex.rxjava3.core.Completable;
17+
import io.reactivex.rxjava3.core.Flowable;
18+
import io.reactivex.rxjava3.core.RxJavaTest;
19+
import org.junit.Test;
20+
21+
import java.util.concurrent.TimeUnit;
22+
23+
public class IoScheduledReleaseTest extends RxJavaTest {
24+
25+
/* This test will be stuck in a deadlock if rx3.io-scheduled-release is not set */
26+
@Test
27+
public void scheduledRelease() {
28+
System.setProperty("rx3.io-scheduled-release", Boolean.TRUE.toString());
29+
Flowable.just("item")
30+
.observeOn(Schedulers.io())
31+
.firstOrError()
32+
.map(item -> {
33+
for (int i = 0; i < 50; i++) {
34+
Completable.complete()
35+
.observeOn(Schedulers.io())
36+
.blockingAwait();
37+
}
38+
return "Done";
39+
})
40+
.ignoreElement()
41+
.test()
42+
.awaitDone(5, TimeUnit.SECONDS)
43+
.assertComplete();
44+
}
45+
}

0 commit comments

Comments
 (0)