use of io.reactivex.rxjava3.subjects in project RxJava by ReactiveX.
the class ConnectableFlowable method connect.
/**
* Instructs the {@code ConnectableFlowable} to begin emitting the items from its underlying
* {@link Flowable} to its {@link Subscriber}s.
* <p>
* To disconnect from a synchronous source, use the {@link #connect(io.reactivex.rxjava3.functions.Consumer)} method.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>The behavior is determined by the implementor of this abstract class.</dd>
* </dl>
*
* @return the subscription representing the connection
* @see <a href="http://reactivex.io/documentation/operators/connect.html">ReactiveX documentation: Connect</a>
*/
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable connect() {
ConnectConsumer cc = new ConnectConsumer();
connect(cc);
return cc.disposable;
}
use of io.reactivex.rxjava3.subjects in project RxJava by ReactiveX.
the class FlowableDelayTest method delayWithFlowableReorder.
@Test
public void delayWithFlowableReorder() {
int n = 3;
PublishProcessor<Integer> source = PublishProcessor.create();
final List<PublishProcessor<Integer>> subjects = new ArrayList<>();
for (int i = 0; i < n; i++) {
subjects.add(PublishProcessor.<Integer>create());
}
Flowable<Integer> result = source.delay(new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
return subjects.get(t1);
}
});
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(subscriber);
result.subscribe(subscriber);
for (int i = 0; i < n; i++) {
source.onNext(i);
}
source.onComplete();
inOrder.verify(subscriber, never()).onNext(anyInt());
inOrder.verify(subscriber, never()).onComplete();
for (int i = n - 1; i >= 0; i--) {
subjects.get(i).onComplete();
inOrder.verify(subscriber).onNext(i);
}
inOrder.verify(subscriber).onComplete();
verify(subscriber, never()).onError(any(Throwable.class));
}
use of io.reactivex.rxjava3.subjects in project RxJava by ReactiveX.
the class JavadocWording method maybeDocRefersToMaybeTypes.
@Test
public void maybeDocRefersToMaybeTypes() throws Exception {
List<RxMethod> list = BaseTypeParser.parse(TestHelper.findSource("Maybe"), "Maybe");
assertFalse(list.isEmpty());
StringBuilder e = new StringBuilder();
for (RxMethod m : list) {
int jdx;
if (m.javadoc != null) {
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("onNext", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("Observable") && !m.signature.contains("ObservableSource")) {
e.append("java.lang.RuntimeException: Maybe doc mentions onNext but no Flowable/Observable in signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Subscriber", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("TestSubscriber")) {
e.append("java.lang.RuntimeException: Maybe doc mentions Subscriber but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Subscription", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable")) {
e.append("java.lang.RuntimeException: Maybe doc mentions Subscription but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Observer", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource") && !m.signature.contains("Observable") && !m.signature.contains("TestObserver")) {
if (idx < 5 || !m.javadoc.substring(idx - 5, idx + 8).equals("MaybeObserver")) {
e.append("java.lang.RuntimeException: Maybe doc mentions Observer but not using Observable\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Publisher", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher")) {
if (idx == 0 || !m.javadoc.substring(idx - 1, idx + 9).equals("(Publisher")) {
e.append("java.lang.RuntimeException: Maybe doc mentions Publisher but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Flowable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Flowable")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Flowable");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Maybe doc mentions Flowable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Single", jdx);
if (idx >= 0 && m.javadoc.indexOf("Single#", jdx) != idx) {
int j = m.javadoc.indexOf("#toSingle", jdx);
int k = m.javadoc.indexOf("{@code Single", jdx);
if (!m.signature.contains("Single") && (j + 3 != idx && k + 7 != idx)) {
e.append("java.lang.RuntimeException: Maybe doc mentions Single but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("SingleSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("SingleSource")) {
e.append("java.lang.RuntimeException: Maybe doc mentions SingleSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Observable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Observable")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Observable");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Maybe doc mentions Observable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("ObservableSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource")) {
e.append("java.lang.RuntimeException: Maybe doc mentions ObservableSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
checkAtReturnAndSignatureMatch("Maybe", m, e, "Flowable", "Observable", "Maybe", "Single", "Completable", "Disposable", "Iterable", "Stream", "Future", "CompletionStage");
aOrAn(e, m, "Maybe");
missingClosingDD(e, m, "Maybe", "io.reactivex.rxjava3.core");
backpressureMentionedWithoutAnnotation(e, m, "Maybe");
}
}
if (e.length() != 0) {
System.out.println(e);
fail(e.toString());
}
}
use of io.reactivex.rxjava3.subjects in project RxJava by ReactiveX.
the class JavadocWording method singleDocRefersToSingleTypes.
@Test
public void singleDocRefersToSingleTypes() throws Exception {
List<RxMethod> list = BaseTypeParser.parse(TestHelper.findSource("Single"), "Single");
assertFalse(list.isEmpty());
StringBuilder e = new StringBuilder();
for (RxMethod m : list) {
int jdx;
if (m.javadoc != null) {
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("onNext", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("Observable") && !m.signature.contains("ObservableSource")) {
e.append("java.lang.RuntimeException: Single doc mentions onNext but no Flowable/Observable in signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Subscriber", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("TestSubscriber")) {
e.append("java.lang.RuntimeException: Single doc mentions Subscriber but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Subscription", jdx);
if (idx >= 0) {
if (!m.signature.contains("Flowable") && !m.signature.contains("Publisher")) {
e.append("java.lang.RuntimeException: Single doc mentions Subscription but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Observer", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource") && !m.signature.contains("Observable") && !m.signature.contains("TestObserver")) {
if (idx < 6 || !m.javadoc.substring(idx - 6, idx + 8).equals("SingleObserver")) {
e.append("java.lang.RuntimeException: Single doc mentions Observer but not using Observable\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Publisher", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher")) {
if (idx == 0 || !m.javadoc.substring(idx - 1, idx + 9).equals("(Publisher")) {
e.append("java.lang.RuntimeException: Single doc mentions Publisher but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Flowable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Flowable")) {
e.append("java.lang.RuntimeException: Single doc mentions Flowable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Maybe", jdx);
if (idx >= 0) {
if (!m.signature.contains("Maybe")) {
e.append("java.lang.RuntimeException: Single doc mentions Maybe but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" MaybeSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("MaybeSource")) {
e.append("java.lang.RuntimeException: Single doc mentions SingleSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Maybe.method(Maybe.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Observable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Observable")) {
e.append("java.lang.RuntimeException: Single doc mentions Observable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" ObservableSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource")) {
e.append("java.lang.RuntimeException: Single doc mentions ObservableSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Single.method(Single.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
checkAtReturnAndSignatureMatch("Single", m, e, "Flowable", "Observable", "Maybe", "Single", "Completable", "Disposable", "Iterable", "Stream", "Future", "CompletionStage");
aOrAn(e, m, "Single");
missingClosingDD(e, m, "Single", "io.reactivex.rxjava3.core");
backpressureMentionedWithoutAnnotation(e, m, "Single");
}
}
if (e.length() != 0) {
System.out.println(e);
fail(e.toString());
}
}
use of io.reactivex.rxjava3.subjects in project RxJava by ReactiveX.
the class JavadocWording method completableDocRefersToCompletableTypes.
@Test
public void completableDocRefersToCompletableTypes() throws Exception {
List<RxMethod> list = BaseTypeParser.parse(TestHelper.findSource("Completable"), "Completable");
assertFalse(list.isEmpty());
StringBuilder e = new StringBuilder();
for (RxMethod m : list) {
int jdx;
if (m.javadoc != null) {
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("onNext", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("Observable") && !m.signature.contains("ObservableSource")) {
e.append("java.lang.RuntimeException: Completable doc mentions onNext but no Flowable/Observable in signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Subscriber", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher") && !m.signature.contains("Flowable") && !m.signature.contains("TestSubscriber")) {
e.append("java.lang.RuntimeException: Completable doc mentions Subscriber but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Subscription", jdx);
if (idx >= 0) {
if (!m.signature.contains("Flowable") && !m.signature.contains("Publisher")) {
e.append("java.lang.RuntimeException: Completable doc mentions Subscription but not using Flowable\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Observer", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource") && !m.signature.contains("Observable") && !m.signature.contains("TestObserver")) {
if (idx < 11 || !m.javadoc.substring(idx - 11, idx + 8).equals("CompletableObserver")) {
e.append("java.lang.RuntimeException: Completable doc mentions Observer but not using Observable\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Publisher", jdx);
if (idx >= 0) {
if (!m.signature.contains("Publisher")) {
if (idx == 0 || !m.javadoc.substring(idx - 1, idx + 9).equals("(Publisher")) {
e.append("java.lang.RuntimeException: Completable doc mentions Publisher but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Flowable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Flowable")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Flowable");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Completable doc mentions Flowable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("Single", jdx);
if (idx >= 0) {
if (!m.signature.contains("Single")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Single");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Completable doc mentions Single but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("SingleSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("SingleSource")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*SingleSource");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Completable doc mentions SingleSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf(" Observable", jdx);
if (idx >= 0) {
if (!m.signature.contains("Observable")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*Observable");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Completable doc mentions Observable but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
jdx = 0;
for (; ; ) {
int idx = m.javadoc.indexOf("ObservableSource", jdx);
if (idx >= 0) {
if (!m.signature.contains("ObservableSource")) {
Pattern p = Pattern.compile("@see\\s+#[A-Za-z0-9 _.,()]*ObservableSource");
if (!p.matcher(m.javadoc).find()) {
e.append("java.lang.RuntimeException: Completable doc mentions ObservableSource but not in the signature\r\n at io.reactivex.rxjava3.core.").append("Completable.method(Completable.java:").append(m.javadocLine + lineNumber(m.javadoc, idx) - 1).append(")\r\n\r\n");
}
}
jdx = idx + 6;
} else {
break;
}
}
checkAtReturnAndSignatureMatch("Completable", m, e, "Flowable", "Observable", "Maybe", "Single", "Completable", "Disposable", "Iterable", "Stream", "Future", "CompletionStage");
aOrAn(e, m, "Completable");
missingClosingDD(e, m, "Completable", "io.reactivex.rxjava3.core");
backpressureMentionedWithoutAnnotation(e, m, "Completable");
}
}
if (e.length() != 0) {
System.out.println(e);
fail(e.toString());
}
}
Aggregations