diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/Async.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/Async.java index 159bf97bd5..ce6962837a 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/Async.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/Async.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -54,10 +54,10 @@ import rx.subjects.Subject; import rx.subscriptions.SerialSubscription; import rx.util.async.operators.Functionals; -import rx.util.async.operators.OperationDeferFuture; -import rx.util.async.operators.OperationForEachFuture; -import rx.util.async.operators.OperationFromFunctionals; -import rx.util.async.operators.OperationStartFuture; +import rx.util.async.operators.OperatorDeferFuture; +import rx.util.async.operators.OperatorForEachFuture; +import rx.util.async.operators.OperatorFromFunctionals; +import rx.util.async.operators.OperatorStartFuture; /** * Utility methods to convert functions and actions into asynchronous operations @@ -1377,7 +1377,7 @@ public static FuncN> asyncFunc(final FuncN func, * @see RxJava Wiki: startFuture() */ public static Observable startFuture(Func0> functionAsync) { - return OperationStartFuture.startFuture(functionAsync); + return OperatorStartFuture.startFuture(functionAsync); } /** @@ -1395,7 +1395,7 @@ public static Observable startFuture(Func0> */ public static Observable startFuture(Func0> functionAsync, Scheduler scheduler) { - return OperationStartFuture.startFuture(functionAsync, scheduler); + return OperatorStartFuture.startFuture(functionAsync, scheduler); } /** @@ -1416,7 +1416,7 @@ public static Observable startFuture(Func0> * @see RxJava Wiki: deferFuture() */ public static Observable deferFuture(Func0>> observableFactoryAsync) { - return OperationDeferFuture.deferFuture(observableFactoryAsync); + return OperatorDeferFuture.deferFuture(observableFactoryAsync); } /** @@ -1437,7 +1437,7 @@ public static Observable deferFuture(Func0 Observable deferFuture( Func0>> observableFactoryAsync, Scheduler scheduler) { - return OperationDeferFuture.deferFuture(observableFactoryAsync, scheduler); + return OperatorDeferFuture.deferFuture(observableFactoryAsync, scheduler); } /** @@ -1453,13 +1453,13 @@ public static Observable deferFuture( * @param source the source Observable * @param onNext the action to call with each emitted element * @return the Future representing the entire for-each operation - * @see #forEachFuture(rx.functions.Action1, rx.Scheduler) + * @see #forEachFuture(rx.Observable, rx.functions.Action1, rx.Scheduler) * @see RxJava Wiki: forEachFuture() */ public static FutureTask forEachFuture( Observable source, Action1 onNext) { - return OperationForEachFuture.forEachFuture(source, onNext); + return OperatorForEachFuture.forEachFuture(source, onNext); } @@ -1477,14 +1477,14 @@ public static FutureTask forEachFuture( * @param onNext the action to call with each emitted element * @param onError the action to call when an exception is emitted * @return the Future representing the entire for-each operation - * @see #forEachFuture(rx.functions.Action1, rx.functions.Action1, rx.Scheduler) + * @see #forEachFuture(rx.Observable, rx.functions.Action1, rx.functions.Action1, rx.Scheduler) * @see RxJava Wiki: forEachFuture() */ public static FutureTask forEachFuture( Observable source, Action1 onNext, Action1 onError) { - return OperationForEachFuture.forEachFuture(source, onNext, onError); + return OperatorForEachFuture.forEachFuture(source, onNext, onError); } @@ -1503,7 +1503,7 @@ public static FutureTask forEachFuture( * @param onError the action to call when an exception is emitted * @param onCompleted the action to call when the source completes * @return the Future representing the entire for-each operation - * @see #forEachFuture(rx.functions.Action1, rx.functions.Action1, rx.functions.Action0, rx.Scheduler) + * @see #forEachFuture(rx.Observable, rx.functions.Action1, rx.functions.Action1, rx.functions.Action0, rx.Scheduler) * @see RxJava Wiki: forEachFuture() */ public static FutureTask forEachFuture( @@ -1511,7 +1511,7 @@ public static FutureTask forEachFuture( Action1 onNext, Action1 onError, Action0 onCompleted) { - return OperationForEachFuture.forEachFuture(source, onNext, onError, onCompleted); + return OperatorForEachFuture.forEachFuture(source, onNext, onError, onCompleted); } @@ -1534,7 +1534,7 @@ public static FutureTask forEachFuture( Observable source, Action1 onNext, Scheduler scheduler) { - FutureTask task = OperationForEachFuture.forEachFuture(source, onNext); + FutureTask task = OperatorForEachFuture.forEachFuture(source, onNext); final Worker inner = scheduler.createWorker(); inner.schedule(Functionals.fromRunnable(task, inner)); return task; @@ -1562,7 +1562,7 @@ public static FutureTask forEachFuture( Action1 onNext, Action1 onError, Scheduler scheduler) { - FutureTask task = OperationForEachFuture.forEachFuture(source, onNext, onError); + FutureTask task = OperatorForEachFuture.forEachFuture(source, onNext, onError); final Worker inner = scheduler.createWorker(); inner.schedule(Functionals.fromRunnable(task, inner)); return task; @@ -1592,7 +1592,7 @@ public static FutureTask forEachFuture( Action1 onError, Action0 onCompleted, Scheduler scheduler) { - FutureTask task = OperationForEachFuture.forEachFuture(source, onNext, onError, onCompleted); + FutureTask task = OperatorForEachFuture.forEachFuture(source, onNext, onError, onCompleted); final Worker inner = scheduler.createWorker(); inner.schedule(Functionals.fromRunnable(task, inner)); return task; @@ -1617,30 +1617,6 @@ public static Observable fromAction(Action0 action, R result) { return fromAction(action, result, Schedulers.computation()); } - /** - * Return an Observable that calls the given function and emits its - * result when an Observer subscribes. - *

- * - *

- * The function is called on the default thread pool for computation. - * - * @param the return type - * @param function the function to call on each subscription - * @return an Observable that calls the given function and emits its - * result when an Observer subscribes - * @see #start(rx.functions.Func0) - * @see #fromCallable(java.util.concurrent.Callable) - * @see RxJava Wiki: fromFunc0() - * - * @deprecated Unnecessary now that Func0 extends Callable. Just call - * {@link #fromCallable(Callable)} instead. - */ - @Deprecated - public static Observable fromFunc0(Func0 function) { - return fromCallable(function); - } - /** * Return an Observable that calls the given Callable and emits its * result or Exception when an Observer subscribes. @@ -1654,7 +1630,6 @@ public static Observable fromFunc0(Func0 function) { * @return an Observable that calls the given Callable and emits its * result or Exception when an Observer subscribes * @see #start(rx.functions.Func0) - * @see #fromFunc0(rx.functions.Func0) * @see RxJava Wiki: fromCallable() */ public static Observable fromCallable(Callable callable) { @@ -1696,33 +1671,9 @@ public static Observable fromRunnable(final Runnable run, final R result) * @see RxJava Wiki: fromAction() */ public static Observable fromAction(Action0 action, R result, Scheduler scheduler) { - return Observable.create(OperationFromFunctionals.fromAction(action, result)).subscribeOn(scheduler); + return Observable.create(OperatorFromFunctionals.fromAction(action, result)).subscribeOn(scheduler); } - /** - * Return an Observable that calls the given function and emits its - * result when an Observer subscribes. - *

- * - * - * @param the return type - * @param function the function to call on each subscription - * @param scheduler the scheduler where the function is called and the - * result is emitted - * @return an Observable that calls the given function and emits its - * result when an Observer subscribes - * @see #start(rx.functions.Func0) - * @see #fromCallable(java.util.concurrent.Callable) - * @see RxJava Wiki: fromFunc0() - * - * @deprecated Unnecessary now that Func0 extends Callable. Just call - * {@link #fromCallable(Callable, Scheduler)} instead. - */ - @Deprecated - public static Observable fromFunc0(Func0 function, Scheduler scheduler) { - return fromCallable(function, scheduler); - } - /** * Return an Observable that calls the given Callable and emits its * result or Exception when an Observer subscribes. @@ -1736,11 +1687,10 @@ public static Observable fromFunc0(Func0 function, Scheduler * @return an Observable that calls the given Callable and emits its * result or Exception when an Observer subscribes * @see #start(rx.functions.Func0) - * @see #fromFunc0(rx.functions.Func0) * @see RxJava Wiki: fromCallable() */ public static Observable fromCallable(Callable callable, Scheduler scheduler) { - return Observable.create(OperationFromFunctionals.fromCallable(callable)).subscribeOn(scheduler); + return Observable.create(OperatorFromFunctionals.fromCallable(callable)).subscribeOn(scheduler); } /** @@ -1759,7 +1709,7 @@ public static Observable fromCallable(Callable callable, Sch * @see RxJava Wiki: fromRunnable() */ public static Observable fromRunnable(final Runnable run, final R result, Scheduler scheduler) { - return Observable.create(OperationFromFunctionals.fromRunnable(run, result)).subscribeOn(scheduler); + return Observable.create(OperatorFromFunctionals.fromRunnable(run, result)).subscribeOn(scheduler); } /** * Runs the provided action on the given scheduler and allows propagation diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/Functionals.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/Functionals.java index 3dc96d0477..a197e183c7 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/Functionals.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/Functionals.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/LatchedObserver.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/LatchedObserver.java index e06dc97cfd..e8e062bb43 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/LatchedObserver.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/LatchedObserver.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationDeferFuture.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorDeferFuture.java similarity index 90% rename from rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationDeferFuture.java rename to rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorDeferFuture.java index a4fde509d9..4e8c524243 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationDeferFuture.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorDeferFuture.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ /** * Defer the execution of a factory method which produces an observable sequence. */ -public final class OperationDeferFuture { +public final class OperatorDeferFuture { /** Utility class. */ - private OperationDeferFuture() { throw new IllegalStateException("No instances!"); } + private OperatorDeferFuture() { throw new IllegalStateException("No instances!"); } /** * Returns an observable sequence that starts the specified asynchronous @@ -49,7 +49,7 @@ public DeferFutureFunc0(Func0 @Override public Observable call() { - return Observable.merge(OperationStartFuture.startFuture(observableFactoryAsync)); + return Observable.merge(OperatorStartFuture.startFuture(observableFactoryAsync)); } } @@ -81,7 +81,7 @@ public DeferFutureFunc0Scheduled(Func0 call() { - return Observable.merge(OperationStartFuture.startFuture(observableFactoryAsync, scheduler)); + return Observable.merge(OperatorStartFuture.startFuture(observableFactoryAsync, scheduler)); } } diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationForEachFuture.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorForEachFuture.java similarity index 96% rename from rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationForEachFuture.java rename to rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorForEachFuture.java index 42be310d36..098aa41aaf 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationForEachFuture.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorForEachFuture.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,9 @@ *

* Remark: the cancellation token version's behavior is in doubt, so left out. */ -public final class OperationForEachFuture { +public final class OperatorForEachFuture { /** Utility class. */ - private OperationForEachFuture() { throw new IllegalStateException("No instances!"); } + private OperatorForEachFuture() { throw new IllegalStateException("No instances!"); } /** * Subscribes to the given source and calls the callback for each emitted item, diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationFromFunctionals.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java similarity index 64% rename from rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationFromFunctionals.java rename to rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java index 57ef639a26..e1e337ae5a 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationFromFunctionals.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,48 +17,35 @@ import java.util.concurrent.Callable; -import rx.Observable.OnSubscribeFunc; -import rx.Observer; -import rx.Subscription; +import rx.Observable.OnSubscribe; +import rx.Subscriber; import rx.functions.Action0; import rx.functions.Actions; import rx.functions.Func0; -import rx.subscriptions.Subscriptions; /** * Operators that invoke a function or action if * an observer subscribes. * Asynchrony can be achieved by using subscribeOn or observeOn. */ -public final class OperationFromFunctionals { +public final class OperatorFromFunctionals { /** Utility class. */ - private OperationFromFunctionals() { throw new IllegalStateException("No instances!"); } + private OperatorFromFunctionals() { throw new IllegalStateException("No instances!"); } /** Subscriber function that invokes an action and returns the given result. */ - public static OnSubscribeFunc fromAction(Action0 action, R result) { + public static OnSubscribe fromAction(Action0 action, R result) { return new InvokeAsync(Actions.toFunc(action, result)); } - /** - * Subscriber function that invokes a function and returns its value. - * - * @deprecated Unnecessary now that Func0 extends Callable. Just call - * {@link #fromCallable(Callable)} instead. - */ - @Deprecated - public static OnSubscribeFunc fromFunc0(Func0 function) { - return fromCallable(function); - } - /** * Subscriber function that invokes the callable and returns its value or * propagates its checked exception. */ - public static OnSubscribeFunc fromCallable(Callable callable) { + public static OnSubscribe fromCallable(Callable callable) { return new InvokeAsync(callable); } /** Subscriber function that invokes a runnable and returns the given result. */ - public static OnSubscribeFunc fromRunnable(final Runnable run, final R result) { + public static OnSubscribe fromRunnable(final Runnable run, final R result) { return new InvokeAsync(new Func0() { @Override public R call() { @@ -72,7 +59,7 @@ public R call() { * Invokes a java.util.concurrent.Callable when an observer subscribes. * @param the return type */ - static final class InvokeAsync implements OnSubscribeFunc { + static final class InvokeAsync implements OnSubscribe { final Callable callable; public InvokeAsync(Callable callable) { if (callable == null) { @@ -81,16 +68,14 @@ public InvokeAsync(Callable callable) { this.callable = callable; } @Override - public Subscription onSubscribe(Observer t1) { - Subscription s = Subscriptions.empty(); + public void call(Subscriber t1) { try { t1.onNext(callable.call()); } catch (Throwable t) { t1.onError(t); - return s; + return; } t1.onCompleted(); - return s; } } } diff --git a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationStartFuture.java b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorStartFuture.java similarity index 75% rename from rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationStartFuture.java rename to rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorStartFuture.java index 3cb0e434f9..25ce2c62f4 100644 --- a/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperationStartFuture.java +++ b/rxjava-contrib/rxjava-async-util/src/main/java/rx/util/async/operators/OperatorStartFuture.java @@ -13,21 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /** - * Copyright 2013 Netflix, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package rx.util.async.operators; import java.util.concurrent.Future; @@ -40,9 +25,9 @@ * Start an asynchronous Future immediately and observe its result through * an observable. */ -public final class OperationStartFuture { +public final class OperatorStartFuture { /** Utility class. */ - private OperationStartFuture() { throw new IllegalStateException("No instances!"); } + private OperatorStartFuture() { throw new IllegalStateException("No instances!"); } /** * Invokes the asynchronous function, surfacing the result through an observable sequence. *

diff --git a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/AsyncTest.java b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/AsyncTest.java index aead8ef078..d156ca4ab4 100644 --- a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/AsyncTest.java +++ b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/AsyncTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationDeferFutureTest.java b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorDeferFutureTest.java similarity index 91% rename from rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationDeferFutureTest.java rename to rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorDeferFutureTest.java index 8eddc63820..16a703e2d6 100644 --- a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationDeferFutureTest.java +++ b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorDeferFutureTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import rx.schedulers.Schedulers; import rx.util.async.Async; -public class OperationDeferFutureTest { +public class OperatorDeferFutureTest { @Test @SuppressWarnings("unchecked") public void testSimple() throws InterruptedException { @@ -64,7 +64,7 @@ public Observable call() throws Exception { final CountDownLatch done = new CountDownLatch(1); - result.subscribe(new OperationStartFutureTest.MockHelper(observer, done)); + result.subscribe(new OperatorStartFutureTest.MockHelper(observer, done)); ready.countDown(); @@ -89,7 +89,7 @@ public void testSimpleFactoryThrows() { @Override public Future> call() { - throw new OperationStartFutureTest.CustomException(); + throw new OperatorStartFutureTest.CustomException(); } }; @@ -100,6 +100,6 @@ public Future> call() { verify(observer, never()).onNext(any()); verify(observer, never()).onCompleted(); - verify(observer).onError(any(OperationStartFutureTest.CustomException.class)); + verify(observer).onError(any(OperatorStartFutureTest.CustomException.class)); } } \ No newline at end of file diff --git a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationForEachFutureTest.java b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorForEachFutureTest.java similarity index 99% rename from rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationForEachFutureTest.java rename to rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorForEachFutureTest.java index 75e6ff074a..0d8a60c85b 100644 --- a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationForEachFutureTest.java +++ b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorForEachFutureTest.java @@ -47,7 +47,7 @@ import rx.schedulers.Schedulers; import rx.util.async.Async; -public class OperationForEachFutureTest { +public class OperatorForEachFutureTest { @Test public void testSimple() { final ExecutorService exec = Executors.newCachedThreadPool(); diff --git a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationFromFunctionalsTest.java b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorFromFunctionalsTest.java similarity index 76% rename from rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationFromFunctionalsTest.java rename to rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorFromFunctionalsTest.java index f89d58ccc5..ce31712175 100644 --- a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationFromFunctionalsTest.java +++ b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorFromFunctionalsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package rx.util.async.operators; -import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; import java.io.IOException; @@ -38,7 +37,7 @@ import rx.schedulers.TestScheduler; import rx.util.async.Async; -public class OperationFromFunctionalsTest { +public class OperatorFromFunctionalsTest { TestScheduler scheduler; @Before public void before() { @@ -47,6 +46,7 @@ public void before() { private void testRunShouldThrow(Observable source, Class exception) { for (int i = 0; i < 3; i++) { + @SuppressWarnings("unchecked") Observer observer = mock(Observer.class); source.subscribe(new TestObserver(observer)); @@ -79,6 +79,7 @@ public void call() { value.set(0); + @SuppressWarnings("unchecked") Observer observer = mock(Observer.class); source.subscribe(new TestObserver(observer)); @@ -111,62 +112,6 @@ public void call() { testRunShouldThrow(source, RuntimeException.class); } - /** - * @deprecated {@link Func0} now extends {@link Callable}, so - * {@link Async#fromFunc0(Func0)} is unnecessary. Once it's - * removed, this test can be removed as well. - */ - @Deprecated - @Test - public void testFromFunc0() { - Func0 func = new Func0() { - @Override - public Integer call() { - return 1; - } - }; - - Observable source = Async.fromFunc0(func, scheduler); - - for (int i = 0; i < 3; i++) { - - Observer observer = mock(Observer.class); - source.subscribe(new TestObserver(observer)); - - InOrder inOrder = inOrder(observer); - - inOrder.verify(observer, never()).onNext(any()); - inOrder.verify(observer, never()).onCompleted(); - - scheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); - - inOrder.verify(observer, times(1)).onNext(1); - inOrder.verify(observer, times(1)).onCompleted(); - inOrder.verifyNoMoreInteractions(); - verify(observer, never()).onError(any(Throwable.class)); - } - } - - /** - * @deprecated {@link Func0} now extends {@link Callable}, so - * {@link Async#fromFunc0(Func0, rx.Scheduler)} is - * unnecessary. Once it's removed, this test can be removed - * as well. - */ - @Deprecated - @Test - public void testFromFunc0Throws() { - Func0 func = new Func0() { - @Override - public Integer call() { - throw new RuntimeException("Forced failure!"); - } - }; - - Observable source = Async.fromFunc0(func, scheduler); - - testRunShouldThrow(source, RuntimeException.class); - } @Test public void testFromRunnable() { final AtomicInteger value = new AtomicInteger(); @@ -184,6 +129,7 @@ public void run() { value.set(0); + @SuppressWarnings("unchecked") Observer observer = mock(Observer.class); source.subscribe(new TestObserver(observer)); @@ -228,6 +174,7 @@ public Integer call() throws Exception { for (int i = 0; i < 3; i++) { + @SuppressWarnings("unchecked") Observer observer = mock(Observer.class); source.subscribe(new TestObserver(observer)); diff --git a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationStartFutureTest.java b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorStartFutureTest.java similarity index 98% rename from rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationStartFutureTest.java rename to rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorStartFutureTest.java index 42856ba2d7..66948f906f 100644 --- a/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperationStartFutureTest.java +++ b/rxjava-contrib/rxjava-async-util/src/test/java/rx/util/async/operators/OperatorStartFutureTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 Netflix, Inc. + * Copyright 2014 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import rx.schedulers.Schedulers; import rx.util.async.Async; -public class OperationStartFutureTest { +public class OperatorStartFutureTest { /** Custom exception to distinguish from any other RuntimeException. */ static class CustomException extends RuntimeException {} /**