From ed49c637fd0c1c54a03f26217c8c99e2a39b1e8a Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:12:59 -0800 Subject: [PATCH 1/6] Migrate Schedulers to rx.schedulers package --- .../rx/{concurrency => schedulers}/CurrentThreadScheduler.java | 2 +- .../java/rx/schedulers}/CurrentThreadSchedulerTest.java | 2 +- .../java/rx/{concurrency => schedulers}/DiscardableAction.java | 2 +- .../java/rx/{concurrency => schedulers}/ExecutorScheduler.java | 2 +- .../GenericScheduledExecutorService.java | 2 +- .../java/rx/{concurrency => schedulers}/ImmediateScheduler.java | 2 +- .../java/rx/schedulers}/ImmediateSchedulerTest.java | 2 +- .../java/rx/{concurrency => schedulers}/NewThreadScheduler.java | 2 +- .../main/java/rx/{concurrency => schedulers}/Schedulers.java | 2 +- .../java/rx/{concurrency => schedulers}/SleepingAction.java | 2 +- .../main/java/rx/{concurrency => schedulers}/TestScheduler.java | 2 +- .../main/java/rx/{concurrency => schedulers}/package-info.java | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/CurrentThreadScheduler.java (99%) rename rxjava-core/src/{test/java/rx/concurrency => main/java/rx/schedulers}/CurrentThreadSchedulerTest.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/DiscardableAction.java (98%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/ExecutorScheduler.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/GenericScheduledExecutorService.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/ImmediateScheduler.java (98%) rename rxjava-core/src/{test/java/rx/concurrency => main/java/rx/schedulers}/ImmediateSchedulerTest.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/NewThreadScheduler.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/Schedulers.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/SleepingAction.java (98%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/TestScheduler.java (99%) rename rxjava-core/src/main/java/rx/{concurrency => schedulers}/package-info.java (96%) diff --git a/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java b/rxjava-core/src/main/java/rx/schedulers/CurrentThreadScheduler.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/CurrentThreadScheduler.java index 9bf1f6ad91c..d1550a24228 100644 --- a/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/CurrentThreadScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.PriorityQueue; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/test/java/rx/concurrency/CurrentThreadSchedulerTest.java b/rxjava-core/src/main/java/rx/schedulers/CurrentThreadSchedulerTest.java similarity index 99% rename from rxjava-core/src/test/java/rx/concurrency/CurrentThreadSchedulerTest.java rename to rxjava-core/src/main/java/rx/schedulers/CurrentThreadSchedulerTest.java index 3613b7c5924..b71d96af9e0 100644 --- a/rxjava-core/src/test/java/rx/concurrency/CurrentThreadSchedulerTest.java +++ b/rxjava-core/src/main/java/rx/schedulers/CurrentThreadSchedulerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import static org.mockito.Mockito.*; diff --git a/rxjava-core/src/main/java/rx/concurrency/DiscardableAction.java b/rxjava-core/src/main/java/rx/schedulers/DiscardableAction.java similarity index 98% rename from rxjava-core/src/main/java/rx/concurrency/DiscardableAction.java rename to rxjava-core/src/main/java/rx/schedulers/DiscardableAction.java index 94d04075c5b..4ba336a864f 100644 --- a/rxjava-core/src/main/java/rx/concurrency/DiscardableAction.java +++ b/rxjava-core/src/main/java/rx/schedulers/DiscardableAction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java b/rxjava-core/src/main/java/rx/schedulers/ExecutorScheduler.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/ExecutorScheduler.java index 1e35735c67d..563e609612b 100644 --- a/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/ExecutorScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; diff --git a/rxjava-core/src/main/java/rx/concurrency/GenericScheduledExecutorService.java b/rxjava-core/src/main/java/rx/schedulers/GenericScheduledExecutorService.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/GenericScheduledExecutorService.java rename to rxjava-core/src/main/java/rx/schedulers/GenericScheduledExecutorService.java index 8bb520d9fee..14546301c51 100644 --- a/rxjava-core/src/main/java/rx/concurrency/GenericScheduledExecutorService.java +++ b/rxjava-core/src/main/java/rx/schedulers/GenericScheduledExecutorService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; diff --git a/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java b/rxjava-core/src/main/java/rx/schedulers/ImmediateScheduler.java similarity index 98% rename from rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/ImmediateScheduler.java index c5a4cef9d48..3963bce4c51 100644 --- a/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/ImmediateScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/test/java/rx/concurrency/ImmediateSchedulerTest.java b/rxjava-core/src/main/java/rx/schedulers/ImmediateSchedulerTest.java similarity index 99% rename from rxjava-core/src/test/java/rx/concurrency/ImmediateSchedulerTest.java rename to rxjava-core/src/main/java/rx/schedulers/ImmediateSchedulerTest.java index 593f6b6a522..bfece3af6c3 100644 --- a/rxjava-core/src/test/java/rx/concurrency/ImmediateSchedulerTest.java +++ b/rxjava-core/src/main/java/rx/schedulers/ImmediateSchedulerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import static org.mockito.Mockito.*; diff --git a/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java b/rxjava-core/src/main/java/rx/schedulers/NewThreadScheduler.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/NewThreadScheduler.java index 036ba621276..b2fdff50d2c 100644 --- a/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/NewThreadScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/rxjava-core/src/main/java/rx/concurrency/Schedulers.java b/rxjava-core/src/main/java/rx/schedulers/Schedulers.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/Schedulers.java rename to rxjava-core/src/main/java/rx/schedulers/Schedulers.java index 1b27b9bf0ae..b0c6a0cc9b3 100644 --- a/rxjava-core/src/main/java/rx/concurrency/Schedulers.java +++ b/rxjava-core/src/main/java/rx/schedulers/Schedulers.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.concurrent.Executor; import java.util.concurrent.Executors; diff --git a/rxjava-core/src/main/java/rx/concurrency/SleepingAction.java b/rxjava-core/src/main/java/rx/schedulers/SleepingAction.java similarity index 98% rename from rxjava-core/src/main/java/rx/concurrency/SleepingAction.java rename to rxjava-core/src/main/java/rx/schedulers/SleepingAction.java index 925403e846e..33b1e869df5 100644 --- a/rxjava-core/src/main/java/rx/concurrency/SleepingAction.java +++ b/rxjava-core/src/main/java/rx/schedulers/SleepingAction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import rx.Scheduler; import rx.Subscription; diff --git a/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java b/rxjava-core/src/main/java/rx/schedulers/TestScheduler.java similarity index 99% rename from rxjava-core/src/main/java/rx/concurrency/TestScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/TestScheduler.java index 04b8c1a2c53..27c8e44f9b0 100644 --- a/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/TestScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package rx.concurrency; +package rx.schedulers; import java.util.Comparator; import java.util.PriorityQueue; diff --git a/rxjava-core/src/main/java/rx/concurrency/package-info.java b/rxjava-core/src/main/java/rx/schedulers/package-info.java similarity index 96% rename from rxjava-core/src/main/java/rx/concurrency/package-info.java rename to rxjava-core/src/main/java/rx/schedulers/package-info.java index e0657722fbe..0bfe32d4747 100644 --- a/rxjava-core/src/main/java/rx/concurrency/package-info.java +++ b/rxjava-core/src/main/java/rx/schedulers/package-info.java @@ -16,4 +16,4 @@ /** * Rx Schedulers */ -package rx.concurrency; \ No newline at end of file +package rx.schedulers; \ No newline at end of file From 95efb4b0738303a1911f22478fea65dc43be4341 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:14:42 -0800 Subject: [PATCH 2/6] Organize Imports - Migrate to rx.schedulers for src/main --- rxjava-core/src/main/java/rx/Observable.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationBuffer.java | 2 +- .../src/main/java/rx/operators/OperationDebounce.java | 2 +- .../src/main/java/rx/operators/OperationDoOnEach.java | 2 +- .../src/main/java/rx/operators/OperationGroupByUntil.java | 1 + .../src/main/java/rx/operators/OperationGroupJoin.java | 1 + .../src/main/java/rx/operators/OperationInterval.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationJoin.java | 1 + .../src/main/java/rx/operators/OperationJoinPatterns.java | 3 +-- .../src/main/java/rx/operators/OperationObserveOn.java | 5 ++--- .../src/main/java/rx/operators/OperationParallel.java | 2 +- .../src/main/java/rx/operators/OperationParallelMerge.java | 2 +- .../main/java/rx/operators/OperationParallelMergeTest.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationRetry.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationSample.java | 3 +-- .../src/main/java/rx/operators/OperationSequenceEqual.java | 4 +--- .../src/main/java/rx/operators/OperationSkipUntil.java | 1 + .../src/main/java/rx/operators/OperationThrottleFirst.java | 2 +- .../src/main/java/rx/operators/OperationTimeInterval.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationTimeout.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationTimer.java | 2 +- rxjava-core/src/main/java/rx/operators/OperationToMap.java | 1 + .../src/main/java/rx/operators/OperationToMultimap.java | 1 + rxjava-core/src/main/java/rx/operators/OperationWindow.java | 2 +- rxjava-core/src/main/java/rx/util/functions/Actions.java | 2 -- rxjava-core/src/main/java/rx/util/functions/Async.java | 4 ++-- 26 files changed, 27 insertions(+), 28 deletions(-) diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java index 15a4d5bff63..e11f9b70568 100644 --- a/rxjava-core/src/main/java/rx/Observable.java +++ b/rxjava-core/src/main/java/rx/Observable.java @@ -27,7 +27,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import rx.concurrency.Schedulers; import rx.joins.Pattern2; import rx.joins.Plan0; import rx.observables.BlockingObservable; @@ -109,6 +108,7 @@ import rx.plugins.RxJavaErrorHandler; import rx.plugins.RxJavaObservableExecutionHook; import rx.plugins.RxJavaPlugins; +import rx.schedulers.Schedulers; import rx.subjects.AsyncSubject; import rx.subjects.PublishSubject; import rx.subjects.ReplaySubject; diff --git a/rxjava-core/src/main/java/rx/operators/OperationBuffer.java b/rxjava-core/src/main/java/rx/operators/OperationBuffer.java index 72cc1df2113..d7c63df23ec 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationBuffer.java +++ b/rxjava-core/src/main/java/rx/operators/OperationBuffer.java @@ -24,7 +24,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; import rx.util.functions.Func0; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationDebounce.java b/rxjava-core/src/main/java/rx/operators/OperationDebounce.java index 3dbdd81f202..2e312fee312 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationDebounce.java +++ b/rxjava-core/src/main/java/rx/operators/OperationDebounce.java @@ -23,7 +23,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Action0; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationDoOnEach.java b/rxjava-core/src/main/java/rx/operators/OperationDoOnEach.java index 1b0aafb5783..871238a0b01 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationDoOnEach.java +++ b/rxjava-core/src/main/java/rx/operators/OperationDoOnEach.java @@ -16,8 +16,8 @@ package rx.operators; import rx.Observable; -import rx.Observer; import rx.Observable.OnSubscribeFunc; +import rx.Observer; import rx.Subscription; /** diff --git a/rxjava-core/src/main/java/rx/operators/OperationGroupByUntil.java b/rxjava-core/src/main/java/rx/operators/OperationGroupByUntil.java index 9869862b92b..63a271a6888 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationGroupByUntil.java +++ b/rxjava-core/src/main/java/rx/operators/OperationGroupByUntil.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationGroupJoin.java b/rxjava-core/src/main/java/rx/operators/OperationGroupJoin.java index 9c14efd6323..56d009db0a0 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationGroupJoin.java +++ b/rxjava-core/src/main/java/rx/operators/OperationGroupJoin.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationInterval.java b/rxjava-core/src/main/java/rx/operators/OperationInterval.java index 72d35d37de9..e6711bfb9ec 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationInterval.java +++ b/rxjava-core/src/main/java/rx/operators/OperationInterval.java @@ -21,7 +21,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/main/java/rx/operators/OperationJoin.java b/rxjava-core/src/main/java/rx/operators/OperationJoin.java index b75b8498b00..f75bf109300 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationJoin.java +++ b/rxjava-core/src/main/java/rx/operators/OperationJoin.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationJoinPatterns.java b/rxjava-core/src/main/java/rx/operators/OperationJoinPatterns.java index ffc304e12ad..be3c5375cf2 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationJoinPatterns.java +++ b/rxjava-core/src/main/java/rx/operators/OperationJoinPatterns.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; @@ -29,11 +30,9 @@ import rx.joins.Pattern1; import rx.joins.Pattern2; import rx.joins.Plan0; -import rx.subjects.PublishSubject; import rx.subscriptions.CompositeSubscription; import rx.util.functions.Action1; import rx.util.functions.Func1; -import rx.util.functions.Func2; /** * Join patterns: And, Then, When. diff --git a/rxjava-core/src/main/java/rx/operators/OperationObserveOn.java b/rxjava-core/src/main/java/rx/operators/OperationObserveOn.java index 22876a4ced7..fed1cf4bb0f 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationObserveOn.java +++ b/rxjava-core/src/main/java/rx/operators/OperationObserveOn.java @@ -24,10 +24,9 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.CurrentThreadScheduler; -import rx.concurrency.ImmediateScheduler; +import rx.schedulers.CurrentThreadScheduler; +import rx.schedulers.ImmediateScheduler; import rx.subscriptions.CompositeSubscription; -import rx.subscriptions.SerialSubscription; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; import rx.util.functions.Action1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationParallel.java b/rxjava-core/src/main/java/rx/operators/OperationParallel.java index 5a584ce370e..32ad3181f3e 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationParallel.java +++ b/rxjava-core/src/main/java/rx/operators/OperationParallel.java @@ -19,8 +19,8 @@ import rx.Observable; import rx.Scheduler; -import rx.concurrency.Schedulers; import rx.observables.GroupedObservable; +import rx.schedulers.Schedulers; import rx.util.functions.Func0; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationParallelMerge.java b/rxjava-core/src/main/java/rx/operators/OperationParallelMerge.java index cb2dd0bc340..86aa31c6090 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationParallelMerge.java +++ b/rxjava-core/src/main/java/rx/operators/OperationParallelMerge.java @@ -19,8 +19,8 @@ import rx.Observable; import rx.Scheduler; -import rx.concurrency.Schedulers; import rx.observables.GroupedObservable; +import rx.schedulers.Schedulers; import rx.util.functions.Func1; public class OperationParallelMerge { diff --git a/rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java b/rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java index a001877a71a..907993ef104 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java +++ b/rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import rx.Observable; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subjects.PublishSubject; import rx.util.functions.Action1; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationRetry.java b/rxjava-core/src/main/java/rx/operators/OperationRetry.java index 430ef53ce4b..450dfe3ebbf 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationRetry.java +++ b/rxjava-core/src/main/java/rx/operators/OperationRetry.java @@ -23,7 +23,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; import rx.subscriptions.MultipleAssignmentSubscription; import rx.util.functions.Func2; diff --git a/rxjava-core/src/main/java/rx/operators/OperationSample.java b/rxjava-core/src/main/java/rx/operators/OperationSample.java index f5f8f96e3f6..a7fb426bf1f 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationSample.java +++ b/rxjava-core/src/main/java/rx/operators/OperationSample.java @@ -24,9 +24,8 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; -import rx.subscriptions.SerialSubscription; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/main/java/rx/operators/OperationSequenceEqual.java b/rxjava-core/src/main/java/rx/operators/OperationSequenceEqual.java index 423ddbc3582..16300b664e2 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationSequenceEqual.java +++ b/rxjava-core/src/main/java/rx/operators/OperationSequenceEqual.java @@ -15,9 +15,7 @@ */ package rx.operators; -import static rx.Observable.concat; -import static rx.Observable.from; -import static rx.Observable.zip; +import static rx.Observable.*; import rx.Notification; import rx.Observable; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/operators/OperationSkipUntil.java b/rxjava-core/src/main/java/rx/operators/OperationSkipUntil.java index e8f04fd383f..7e89b741e8b 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationSkipUntil.java +++ b/rxjava-core/src/main/java/rx/operators/OperationSkipUntil.java @@ -16,6 +16,7 @@ package rx.operators; import java.util.concurrent.atomic.AtomicBoolean; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationThrottleFirst.java b/rxjava-core/src/main/java/rx/operators/OperationThrottleFirst.java index e21617a82c7..8f5568d1b5d 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationThrottleFirst.java +++ b/rxjava-core/src/main/java/rx/operators/OperationThrottleFirst.java @@ -23,7 +23,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Func1; /** diff --git a/rxjava-core/src/main/java/rx/operators/OperationTimeInterval.java b/rxjava-core/src/main/java/rx/operators/OperationTimeInterval.java index 2cd18607119..fe45b0c72d3 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationTimeInterval.java +++ b/rxjava-core/src/main/java/rx/operators/OperationTimeInterval.java @@ -20,7 +20,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.TimeInterval; /** diff --git a/rxjava-core/src/main/java/rx/operators/OperationTimeout.java b/rxjava-core/src/main/java/rx/operators/OperationTimeout.java index b52c7a5a43a..8f4c5b4b0e1 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationTimeout.java +++ b/rxjava-core/src/main/java/rx/operators/OperationTimeout.java @@ -25,7 +25,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; import rx.subscriptions.SerialSubscription; import rx.util.functions.Action0; diff --git a/rxjava-core/src/main/java/rx/operators/OperationTimer.java b/rxjava-core/src/main/java/rx/operators/OperationTimer.java index 3bb462cac08..c8f9f3b33c4 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationTimer.java +++ b/rxjava-core/src/main/java/rx/operators/OperationTimer.java @@ -21,7 +21,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/main/java/rx/operators/OperationToMap.java b/rxjava-core/src/main/java/rx/operators/OperationToMap.java index 754ff82d645..12963ce6a4b 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationToMap.java +++ b/rxjava-core/src/main/java/rx/operators/OperationToMap.java @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationToMultimap.java b/rxjava-core/src/main/java/rx/operators/OperationToMultimap.java index 7210ee45e73..92e8f68432d 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationToMultimap.java +++ b/rxjava-core/src/main/java/rx/operators/OperationToMultimap.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; + import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; diff --git a/rxjava-core/src/main/java/rx/operators/OperationWindow.java b/rxjava-core/src/main/java/rx/operators/OperationWindow.java index f18a700bd23..ef867898ed8 100644 --- a/rxjava-core/src/main/java/rx/operators/OperationWindow.java +++ b/rxjava-core/src/main/java/rx/operators/OperationWindow.java @@ -22,7 +22,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Func0; import rx.util.functions.Func1; diff --git a/rxjava-core/src/main/java/rx/util/functions/Actions.java b/rxjava-core/src/main/java/rx/util/functions/Actions.java index 4fb017cb36e..7a33d451ce0 100644 --- a/rxjava-core/src/main/java/rx/util/functions/Actions.java +++ b/rxjava-core/src/main/java/rx/util/functions/Actions.java @@ -16,8 +16,6 @@ package rx.util.functions; import rx.Observer; -import rx.util.functions.Action0; -import rx.util.functions.Action1; /** * Utility class for the Action interfaces. diff --git a/rxjava-core/src/main/java/rx/util/functions/Async.java b/rxjava-core/src/main/java/rx/util/functions/Async.java index f31ab3780c8..51a17877151 100644 --- a/rxjava-core/src/main/java/rx/util/functions/Async.java +++ b/rxjava-core/src/main/java/rx/util/functions/Async.java @@ -18,8 +18,8 @@ import rx.Observable; import rx.Scheduler; -import rx.concurrency.ExecutorScheduler; -import rx.concurrency.Schedulers; +import rx.schedulers.ExecutorScheduler; +import rx.schedulers.Schedulers; import rx.subjects.AsyncSubject; /** From 1880ec57b5d649955ce2a7aec237456a595650ec Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:35:01 -0800 Subject: [PATCH 3/6] Backwards compatible deprecated rx.concurrency classes These will exist for a few releases to allow people to migrate from rx.concurrency to rx.schedulers. --- .../concurrency/CurrentThreadScheduler.java | 39 +++++++ .../rx/concurrency/ExecutorScheduler.java | 24 +++++ .../rx/concurrency/ImmediateScheduler.java | 39 +++++++ .../rx/concurrency/NewThreadScheduler.java | 39 +++++++ .../src/main/java/rx/concurrency/README.txt | 3 + .../main/java/rx/concurrency/Schedulers.java | 100 ++++++++++++++++++ .../java/rx/concurrency/TestScheduler.java | 14 +++ .../operators/OperationParallelMergeTest.java | 0 .../CurrentThreadSchedulerTest.java | 0 .../rx/schedulers/ImmediateSchedulerTest.java | 0 10 files changed, 258 insertions(+) create mode 100644 rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java create mode 100644 rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java create mode 100644 rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java create mode 100644 rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java create mode 100644 rxjava-core/src/main/java/rx/concurrency/README.txt create mode 100644 rxjava-core/src/main/java/rx/concurrency/Schedulers.java create mode 100644 rxjava-core/src/main/java/rx/concurrency/TestScheduler.java rename rxjava-core/src/{main => test}/java/rx/operators/OperationParallelMergeTest.java (100%) rename rxjava-core/src/{main => test}/java/rx/schedulers/CurrentThreadSchedulerTest.java (100%) rename rxjava-core/src/{main => test}/java/rx/schedulers/ImmediateSchedulerTest.java (100%) diff --git a/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java b/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java new file mode 100644 index 00000000000..ed905af3e5c --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java @@ -0,0 +1,39 @@ +package rx.concurrency; + +import java.util.concurrent.TimeUnit; + +import rx.Scheduler; +import rx.Subscription; +import rx.util.functions.Func2; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.CurrentThreadScheduler} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class CurrentThreadScheduler extends Scheduler { + + private final static CurrentThreadScheduler INSTANCE = new CurrentThreadScheduler(); + + public static CurrentThreadScheduler getInstance() { + return INSTANCE; + } + + private final rx.schedulers.CurrentThreadScheduler actual; + + private CurrentThreadScheduler() { + actual = rx.schedulers.CurrentThreadScheduler.getInstance(); + } + + @Override + public Subscription schedule(T state, Func2 action) { + return actual.schedule(state, action); + } + + @Override + public Subscription schedule(T state, Func2 action, long delayTime, TimeUnit unit) { + return actual.schedule(state, action, delayTime, unit); + } + +} diff --git a/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java b/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java new file mode 100644 index 00000000000..ecfcddc2860 --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java @@ -0,0 +1,24 @@ +package rx.concurrency; + +import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledExecutorService; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.ExecutorScheduler} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class ExecutorScheduler extends rx.schedulers.ExecutorScheduler { + + @Deprecated + public ExecutorScheduler(Executor executor) { + super(executor); + } + + @Deprecated + public ExecutorScheduler(ScheduledExecutorService executor) { + super(executor); + } + +} diff --git a/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java b/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java new file mode 100644 index 00000000000..001208d64c3 --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java @@ -0,0 +1,39 @@ +package rx.concurrency; + +import java.util.concurrent.TimeUnit; + +import rx.Scheduler; +import rx.Subscription; +import rx.util.functions.Func2; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.ImmediateScheduler} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class ImmediateScheduler extends Scheduler { + + private final static ImmediateScheduler INSTANCE = new ImmediateScheduler(); + + public static ImmediateScheduler getInstance() { + return INSTANCE; + } + + private final rx.schedulers.ImmediateScheduler actual; + + private ImmediateScheduler() { + actual = rx.schedulers.ImmediateScheduler.getInstance(); + } + + @Override + public Subscription schedule(T state, Func2 action) { + return actual.schedule(state, action); + } + + @Override + public Subscription schedule(T state, Func2 action, long delayTime, TimeUnit unit) { + return actual.schedule(state, action, delayTime, unit); + } + +} diff --git a/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java b/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java new file mode 100644 index 00000000000..fac4aa1fe0c --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java @@ -0,0 +1,39 @@ +package rx.concurrency; + +import java.util.concurrent.TimeUnit; + +import rx.Scheduler; +import rx.Subscription; +import rx.util.functions.Func2; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.NewThreadScheduler} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class NewThreadScheduler extends Scheduler { + + private final static NewThreadScheduler INSTANCE = new NewThreadScheduler(); + + public static NewThreadScheduler getInstance() { + return INSTANCE; + } + + private final rx.schedulers.NewThreadScheduler actual; + + private NewThreadScheduler() { + actual = rx.schedulers.NewThreadScheduler.getInstance(); + } + + @Override + public Subscription schedule(T state, Func2 action) { + return actual.schedule(state, action); + } + + @Override + public Subscription schedule(T state, Func2 action, long delayTime, TimeUnit unit) { + return actual.schedule(state, action, delayTime, unit); + } + +} diff --git a/rxjava-core/src/main/java/rx/concurrency/README.txt b/rxjava-core/src/main/java/rx/concurrency/README.txt new file mode 100644 index 00000000000..d9048bbbc95 --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/README.txt @@ -0,0 +1,3 @@ +This package is deprecated and will be removed prior to a 1.0 release. + +Use rx.schedulers.* instead of rx.concurrency.* \ No newline at end of file diff --git a/rxjava-core/src/main/java/rx/concurrency/Schedulers.java b/rxjava-core/src/main/java/rx/concurrency/Schedulers.java new file mode 100644 index 00000000000..a257d54e67b --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/Schedulers.java @@ -0,0 +1,100 @@ +package rx.concurrency; + +import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledExecutorService; + +import rx.Scheduler; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.Schedulers} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class Schedulers { + + /** + * {@link Scheduler} that executes work immediately on the current thread. + * + * @return {@link ImmediateScheduler} instance + */ + @Deprecated + public static Scheduler immediate() { + return rx.schedulers.ImmediateScheduler.getInstance(); + } + + /** + * {@link Scheduler} that queues work on the current thread to be executed after the current work completes. + * + * @return {@link CurrentThreadScheduler} instance + */ + @Deprecated + public static Scheduler currentThread() { + return rx.schedulers.CurrentThreadScheduler.getInstance(); + } + + /** + * {@link Scheduler} that creates a new {@link Thread} for each unit of work. + * + * @return {@link NewThreadScheduler} instance + */ + @Deprecated + public static Scheduler newThread() { + return rx.schedulers.NewThreadScheduler.getInstance(); + } + + /** + * {@link Scheduler} that queues work on an {@link Executor}. + *

+ * Note that this does not support scheduled actions with a delay. + * + * @return {@link ExecutorScheduler} instance + */ + @Deprecated + public static Scheduler executor(Executor executor) { + return new rx.schedulers.ExecutorScheduler(executor); + } + + /** + * {@link Scheduler} that queues work on an {@link ScheduledExecutorService}. + * + * @return {@link ExecutorScheduler} instance + */ + @Deprecated + public static Scheduler executor(ScheduledExecutorService executor) { + return new rx.schedulers.ExecutorScheduler(executor); + } + + /** + * {@link Scheduler} intended for computational work. + *

+ * The implementation is backed by a {@link ScheduledExecutorService} thread-pool sized to the number of CPU cores. + *

+ * This can be used for event-loops, processing callbacks and other computational work. + *

+ * Do not perform IO-bound work on this scheduler. Use {@link #threadPoolForComputation()} instead. + * + * @return {@link ExecutorScheduler} for computation-bound work. + */ + @Deprecated + public static Scheduler threadPoolForComputation() { + return rx.schedulers.Schedulers.threadPoolForComputation(); + } + + /** + * {@link Scheduler} intended for IO-bound work. + *

+ * The implementation is backed by an {@link Executor} thread-pool that will grow as needed. + *

+ * This can be used for asynchronously performing blocking IO. + *

+ * Do not perform computational work on this scheduler. Use {@link #threadPoolForComputation()} instead. + * + * @return {@link ExecutorScheduler} for IO-bound work. + */ + @Deprecated + public static Scheduler threadPoolForIO() { + return rx.schedulers.Schedulers.threadPoolForIO(); + } + +} diff --git a/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java b/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java new file mode 100644 index 00000000000..fbf3e76b7d2 --- /dev/null +++ b/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java @@ -0,0 +1,14 @@ +package rx.concurrency; + +/** + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.TestScheduler} instead. This will be removed before 1.0 release. + */ +@Deprecated +public class TestScheduler extends rx.schedulers.TestScheduler { + + public TestScheduler() { + } + +} diff --git a/rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java b/rxjava-core/src/test/java/rx/operators/OperationParallelMergeTest.java similarity index 100% rename from rxjava-core/src/main/java/rx/operators/OperationParallelMergeTest.java rename to rxjava-core/src/test/java/rx/operators/OperationParallelMergeTest.java diff --git a/rxjava-core/src/main/java/rx/schedulers/CurrentThreadSchedulerTest.java b/rxjava-core/src/test/java/rx/schedulers/CurrentThreadSchedulerTest.java similarity index 100% rename from rxjava-core/src/main/java/rx/schedulers/CurrentThreadSchedulerTest.java rename to rxjava-core/src/test/java/rx/schedulers/CurrentThreadSchedulerTest.java diff --git a/rxjava-core/src/main/java/rx/schedulers/ImmediateSchedulerTest.java b/rxjava-core/src/test/java/rx/schedulers/ImmediateSchedulerTest.java similarity index 100% rename from rxjava-core/src/main/java/rx/schedulers/ImmediateSchedulerTest.java rename to rxjava-core/src/test/java/rx/schedulers/ImmediateSchedulerTest.java From 52530b855543eca1878844b481204536f394ac22 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:48:15 -0800 Subject: [PATCH 4/6] rx.concurrent -> rx.schedulers for Android and Swing modules --- .../concurrency/AndroidSchedulers.java | 47 +-- .../concurrency/HandlerThreadScheduler.java | 127 +------- .../android/schedulers/AndroidSchedulers.java | 51 ++++ .../schedulers/HandlerThreadScheduler.java | 132 +++++++++ .../OperationObserveFromAndroidComponent.java | 4 +- .../java/rx/concurrency/SwingScheduler.java | 261 +---------------- .../java/rx/schedulers/SwingScheduler.java | 274 ++++++++++++++++++ .../SchedulerUnsubscribeTest.java | 0 8 files changed, 490 insertions(+), 406 deletions(-) create mode 100644 rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/AndroidSchedulers.java create mode 100644 rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/HandlerThreadScheduler.java create mode 100644 rxjava-contrib/rxjava-swing/src/main/java/rx/schedulers/SwingScheduler.java rename rxjava-core/src/test/java/rx/{concurrency => schedulers}/SchedulerUnsubscribeTest.java (100%) diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java index 0b238b1644d..982a80bdf6f 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java @@ -1,51 +1,24 @@ -/** - * 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.android.concurrency; -import android.os.Handler; -import android.os.Looper; import rx.Scheduler; +import android.os.Handler; /** - * Schedulers that have Android specific functionality + * Deprecated. Package changed from rx.android.concurrency to rx.android.schedulers. + * + * @deprecated Use {@link rx.android.schedulers.AndroidSchedulers} instead. This will be removed before 1.0 release. */ +@Deprecated public class AndroidSchedulers { - private static final Scheduler MAIN_THREAD_SCHEDULER = - new HandlerThreadScheduler(new Handler(Looper.getMainLooper())); - - private AndroidSchedulers(){ - - } - - /** - * {@link Scheduler} which uses the provided {@link Handler} to execute an action - * @param handler The handler that will be used when executing the action - * @return A handler based scheduler - */ + @Deprecated public static Scheduler handlerThread(final Handler handler) { - return new HandlerThreadScheduler(handler); + return rx.android.schedulers.AndroidSchedulers.handlerThread(handler); } - /** - * {@link Scheduler} which will execute an action on the main Android UI thread. - * - * @return A Main {@link Looper} based scheduler - */ + @Deprecated public static Scheduler mainThread() { - return MAIN_THREAD_SCHEDULER; + return rx.android.schedulers.AndroidSchedulers.mainThread(); } + } diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java index ae01d17c1aa..8def41024f3 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java @@ -1,132 +1,17 @@ -/** - * 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.android.concurrency; import android.os.Handler; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; - -import rx.Scheduler; -import rx.Subscription; -import rx.operators.SafeObservableSubscription; -import rx.util.functions.Func2; - -import java.util.concurrent.TimeUnit; - -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - /** - * Schedules actions to run on an Android Handler thread. + * Deprecated. Package changed from rx.android.concurrency to rx.android.schedulers. + * + * @deprecated Use {@link rx.android.schedulers.HandlerThreadScheduler} instead. This will be removed before 1.0 release. */ -public class HandlerThreadScheduler extends Scheduler { +@Deprecated +public class HandlerThreadScheduler extends rx.android.schedulers.HandlerThreadScheduler { - private final Handler handler; - - /** - * Constructs a {@link HandlerThreadScheduler} using the given {@link Handler} - * @param handler {@link Handler} to use when scheduling actions - */ public HandlerThreadScheduler(Handler handler) { - this.handler = handler; - } - - /** - * Calls {@link HandlerThreadScheduler#schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)} - * with a delay of zero milliseconds. - * - * See {@link #schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)} - */ - @Override - public Subscription schedule(final T state, final Func2 action) { - return schedule(state, action, 0L, TimeUnit.MILLISECONDS); - } - - /** - * Calls {@link Handler#postDelayed(Runnable, long)} with a runnable that executes the given action. - * @param state - * State to pass into the action. - * @param action - * Action to schedule. - * @param delayTime - * Time the action is to be delayed before executing. - * @param unit - * Time unit of the delay time. - * @return A Subscription from which one can unsubscribe from. - */ - @Override - public Subscription schedule(final T state, final Func2 action, long delayTime, TimeUnit unit) { - final SafeObservableSubscription subscription = new SafeObservableSubscription(); - final Scheduler _scheduler = this; - handler.postDelayed(new Runnable() { - @Override - public void run() { - subscription.wrap(action.call(_scheduler, state)); - } - }, unit.toMillis(delayTime)); - return subscription; + super(handler); } - @RunWith(RobolectricTestRunner.class) - @Config(manifest=Config.NONE) - public static final class UnitTest { - - @Test - public void shouldScheduleImmediateActionOnHandlerThread() { - final Handler handler = mock(Handler.class); - final Object state = new Object(); - @SuppressWarnings("unchecked") - final Func2 action = mock(Func2.class); - - Scheduler scheduler = new HandlerThreadScheduler(handler); - scheduler.schedule(state, action); - - // verify that we post to the given Handler - ArgumentCaptor runnable = ArgumentCaptor.forClass(Runnable.class); - verify(handler).postDelayed(runnable.capture(), eq(0L)); - - // verify that the given handler delegates to our action - runnable.getValue().run(); - verify(action).call(scheduler, state); - } - - @Test - public void shouldScheduleDelayedActionOnHandlerThread() { - final Handler handler = mock(Handler.class); - final Object state = new Object(); - @SuppressWarnings("unchecked") - final Func2 action = mock(Func2.class); - - Scheduler scheduler = new HandlerThreadScheduler(handler); - scheduler.schedule(state, action, 1L, TimeUnit.SECONDS); - - // verify that we post to the given Handler - ArgumentCaptor runnable = ArgumentCaptor.forClass(Runnable.class); - verify(handler).postDelayed(runnable.capture(), eq(1000L)); - - // verify that the given handler delegates to our action - runnable.getValue().run(); - verify(action).call(scheduler, state); - } - } } - - diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/AndroidSchedulers.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/AndroidSchedulers.java new file mode 100644 index 00000000000..5120c8e848e --- /dev/null +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/AndroidSchedulers.java @@ -0,0 +1,51 @@ +/** + * 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.android.schedulers; + +import android.os.Handler; +import android.os.Looper; +import rx.Scheduler; + +/** + * Schedulers that have Android specific functionality + */ +public class AndroidSchedulers { + + private static final Scheduler MAIN_THREAD_SCHEDULER = + new HandlerThreadScheduler(new Handler(Looper.getMainLooper())); + + private AndroidSchedulers(){ + + } + + /** + * {@link Scheduler} which uses the provided {@link Handler} to execute an action + * @param handler The handler that will be used when executing the action + * @return A handler based scheduler + */ + public static Scheduler handlerThread(final Handler handler) { + return new HandlerThreadScheduler(handler); + } + + /** + * {@link Scheduler} which will execute an action on the main Android UI thread. + * + * @return A Main {@link Looper} based scheduler + */ + public static Scheduler mainThread() { + return MAIN_THREAD_SCHEDULER; + } +} diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/HandlerThreadScheduler.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/HandlerThreadScheduler.java new file mode 100644 index 00000000000..8535dda2955 --- /dev/null +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/schedulers/HandlerThreadScheduler.java @@ -0,0 +1,132 @@ +/** + * 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.android.schedulers; + +import android.os.Handler; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import rx.Scheduler; +import rx.Subscription; +import rx.operators.SafeObservableSubscription; +import rx.util.functions.Func2; + +import java.util.concurrent.TimeUnit; + +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +/** + * Schedules actions to run on an Android Handler thread. + */ +public class HandlerThreadScheduler extends Scheduler { + + private final Handler handler; + + /** + * Constructs a {@link HandlerThreadScheduler} using the given {@link Handler} + * @param handler {@link Handler} to use when scheduling actions + */ + public HandlerThreadScheduler(Handler handler) { + this.handler = handler; + } + + /** + * Calls {@link HandlerThreadScheduler#schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)} + * with a delay of zero milliseconds. + * + * See {@link #schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)} + */ + @Override + public Subscription schedule(final T state, final Func2 action) { + return schedule(state, action, 0L, TimeUnit.MILLISECONDS); + } + + /** + * Calls {@link Handler#postDelayed(Runnable, long)} with a runnable that executes the given action. + * @param state + * State to pass into the action. + * @param action + * Action to schedule. + * @param delayTime + * Time the action is to be delayed before executing. + * @param unit + * Time unit of the delay time. + * @return A Subscription from which one can unsubscribe from. + */ + @Override + public Subscription schedule(final T state, final Func2 action, long delayTime, TimeUnit unit) { + final SafeObservableSubscription subscription = new SafeObservableSubscription(); + final Scheduler _scheduler = this; + handler.postDelayed(new Runnable() { + @Override + public void run() { + subscription.wrap(action.call(_scheduler, state)); + } + }, unit.toMillis(delayTime)); + return subscription; + } + + @RunWith(RobolectricTestRunner.class) + @Config(manifest=Config.NONE) + public static final class UnitTest { + + @Test + public void shouldScheduleImmediateActionOnHandlerThread() { + final Handler handler = mock(Handler.class); + final Object state = new Object(); + @SuppressWarnings("unchecked") + final Func2 action = mock(Func2.class); + + Scheduler scheduler = new HandlerThreadScheduler(handler); + scheduler.schedule(state, action); + + // verify that we post to the given Handler + ArgumentCaptor runnable = ArgumentCaptor.forClass(Runnable.class); + verify(handler).postDelayed(runnable.capture(), eq(0L)); + + // verify that the given handler delegates to our action + runnable.getValue().run(); + verify(action).call(scheduler, state); + } + + @Test + public void shouldScheduleDelayedActionOnHandlerThread() { + final Handler handler = mock(Handler.class); + final Object state = new Object(); + @SuppressWarnings("unchecked") + final Func2 action = mock(Func2.class); + + Scheduler scheduler = new HandlerThreadScheduler(handler); + scheduler.schedule(state, action, 1L, TimeUnit.SECONDS); + + // verify that we post to the given Handler + ArgumentCaptor runnable = ArgumentCaptor.forClass(Runnable.class); + verify(handler).postDelayed(runnable.capture(), eq(1000L)); + + // verify that the given handler delegates to our action + runnable.getValue().run(); + verify(action).call(scheduler, state); + } + } +} + + diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/operators/OperationObserveFromAndroidComponent.java b/rxjava-contrib/rxjava-android/src/main/java/rx/operators/OperationObserveFromAndroidComponent.java index cfce38f8bb9..06b22dae5cb 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/operators/OperationObserveFromAndroidComponent.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/operators/OperationObserveFromAndroidComponent.java @@ -31,12 +31,12 @@ import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; + import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.android.concurrency.AndroidSchedulers; +import rx.android.schedulers.AndroidSchedulers; import rx.subjects.PublishSubject; - import android.app.Activity; import android.app.Fragment; import android.os.Looper; diff --git a/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java b/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java index f2d10d69b08..c9fcb18a1f5 100644 --- a/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java +++ b/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java @@ -1,274 +1,43 @@ -/** - * 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.concurrency; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.awt.EventQueue; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -import javax.swing.SwingUtilities; -import javax.swing.Timer; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.mockito.InOrder; import rx.Scheduler; import rx.Subscription; -import rx.subscriptions.CompositeSubscription; -import rx.subscriptions.Subscriptions; -import rx.util.functions.Action0; import rx.util.functions.Func2; /** - * Executes work on the Swing UI thread. - * This scheduler should only be used with actions that execute quickly. + * Deprecated. Package changed from rx.concurrency to rx.schedulers. + * + * @deprecated Use {@link rx.schedulers.SwingScheduler} instead. This will be removed before 1.0 release. */ -public final class SwingScheduler extends Scheduler { - private static final SwingScheduler INSTANCE = new SwingScheduler(); +@Deprecated +public class SwingScheduler extends Scheduler { + + private final static SwingScheduler INSTANCE = new SwingScheduler(); public static SwingScheduler getInstance() { return INSTANCE; } + private final rx.schedulers.SwingScheduler actual; + private SwingScheduler() { + actual = rx.schedulers.SwingScheduler.getInstance(); } @Override - public Subscription schedule(final T state, final Func2 action) { - final AtomicReference sub = new AtomicReference(); - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - sub.set(action.call(SwingScheduler.this, state)); - } - }); - return Subscriptions.create(new Action0() { - @Override - public void call() { - Subscription subscription = sub.get(); - if (subscription != null) { - subscription.unsubscribe(); - } - } - }); + public Subscription schedule(T state, Func2 action) { + return actual.schedule(state, action); } @Override - public Subscription schedule(final T state, final Func2 action, long dueTime, TimeUnit unit) { - final AtomicReference sub = new AtomicReference(); - long delay = unit.toMillis(dueTime); - assertThatTheDelayIsValidForTheSwingTimer(delay); - - class ExecuteOnceAction implements ActionListener { - private Timer timer; - - private void setTimer(Timer timer) { - this.timer = timer; - } - - @Override - public void actionPerformed(ActionEvent e) { - timer.stop(); - sub.set(action.call(SwingScheduler.this, state)); - } - } - - ExecuteOnceAction executeOnce = new ExecuteOnceAction(); - final Timer timer = new Timer((int) delay, executeOnce); - executeOnce.setTimer(timer); - timer.start(); - - return Subscriptions.create(new Action0() { - @Override - public void call() { - timer.stop(); - - Subscription subscription = sub.get(); - if (subscription != null) { - subscription.unsubscribe(); - } - } - }); + public Subscription schedule(T state, Func2 action, long delayTime, TimeUnit unit) { + return actual.schedule(state, action, delayTime, unit); } - @Override public Subscription schedulePeriodically(T state, final Func2 action, long initialDelay, long period, TimeUnit unit) { - final AtomicReference timer = new AtomicReference(); - - final long delay = unit.toMillis(period); - assertThatTheDelayIsValidForTheSwingTimer(delay); - - final CompositeSubscription subscriptions = new CompositeSubscription(); - final Func2 initialAction = new Func2() { - @Override - public Subscription call(final Scheduler scheduler, final T state0) { - // start timer for periodic execution, collect subscriptions - timer.set(new Timer((int) delay, new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - subscriptions.add(action.call(scheduler, state0)); - } - })); - timer.get().start(); - - return action.call(scheduler, state0); - } - }; - subscriptions.add(schedule(state, initialAction, initialDelay, unit)); - - subscriptions.add(Subscriptions.create(new Action0() { - @Override - public void call() { - // in addition to all the individual unsubscriptions, stop the timer on unsubscribing - Timer maybeTimer = timer.get(); - if (maybeTimer != null) { - maybeTimer.stop(); - } - } - })); - - return subscriptions; + return actual.schedulePeriodically(state, action, initialDelay, period, unit); } - private static void assertThatTheDelayIsValidForTheSwingTimer(long delay) { - if (delay < 0 || delay > Integer.MAX_VALUE) { - throw new IllegalArgumentException(String.format("The swing timer only accepts non-negative delays up to %d milliseconds.", Integer.MAX_VALUE)); - } - } - - public static class UnitTest { - @Rule - public ExpectedException exception = ExpectedException.none(); - - @Test - public void testInvalidDelayValues() { - final SwingScheduler scheduler = new SwingScheduler(); - final Action0 action = mock(Action0.class); - - exception.expect(IllegalArgumentException.class); - scheduler.schedulePeriodically(action, -1L, 100L, TimeUnit.SECONDS); - - exception.expect(IllegalArgumentException.class); - scheduler.schedulePeriodically(action, 100L, -1L, TimeUnit.SECONDS); - - exception.expect(IllegalArgumentException.class); - scheduler.schedulePeriodically(action, 1L + Integer.MAX_VALUE, 100L, TimeUnit.MILLISECONDS); - - exception.expect(IllegalArgumentException.class); - scheduler.schedulePeriodically(action, 100L, 1L + Integer.MAX_VALUE / 1000, TimeUnit.SECONDS); - } - - @Test - public void testPeriodicScheduling() throws Exception { - final SwingScheduler scheduler = new SwingScheduler(); - - final CountDownLatch latch = new CountDownLatch(4); - - final Action0 innerAction = mock(Action0.class); - final Action0 action = new Action0() { - @Override - public void call() { - try { - innerAction.call(); - assertTrue(SwingUtilities.isEventDispatchThread()); - } finally { - latch.countDown(); - } - } - }; - - Subscription sub = scheduler.schedulePeriodically(action, 50, 200, TimeUnit.MILLISECONDS); - - if (!latch.await(5000, TimeUnit.MILLISECONDS)) { - fail("timed out waiting for tasks to execute"); - } - - sub.unsubscribe(); - waitForEmptyEventQueue(); - verify(innerAction, times(4)).call(); - } - - @Test - public void testNestedActions() throws Exception { - final SwingScheduler scheduler = new SwingScheduler(); - - final Action0 firstStepStart = mock(Action0.class); - final Action0 firstStepEnd = mock(Action0.class); - - final Action0 secondStepStart = mock(Action0.class); - final Action0 secondStepEnd = mock(Action0.class); - - final Action0 thirdStepStart = mock(Action0.class); - final Action0 thirdStepEnd = mock(Action0.class); - - final Action0 firstAction = new Action0() { - @Override - public void call() { - assertTrue(SwingUtilities.isEventDispatchThread()); - firstStepStart.call(); - firstStepEnd.call(); - } - }; - final Action0 secondAction = new Action0() { - @Override - public void call() { - assertTrue(SwingUtilities.isEventDispatchThread()); - secondStepStart.call(); - scheduler.schedule(firstAction); - secondStepEnd.call(); - } - }; - final Action0 thirdAction = new Action0() { - @Override - public void call() { - assertTrue(SwingUtilities.isEventDispatchThread()); - thirdStepStart.call(); - scheduler.schedule(secondAction); - thirdStepEnd.call(); - } - }; - - InOrder inOrder = inOrder(firstStepStart, firstStepEnd, secondStepStart, secondStepEnd, thirdStepStart, thirdStepEnd); - - scheduler.schedule(thirdAction); - waitForEmptyEventQueue(); - - inOrder.verify(thirdStepStart, times(1)).call(); - inOrder.verify(thirdStepEnd, times(1)).call(); - inOrder.verify(secondStepStart, times(1)).call(); - inOrder.verify(secondStepEnd, times(1)).call(); - inOrder.verify(firstStepStart, times(1)).call(); - inOrder.verify(firstStepEnd, times(1)).call(); - } - - private static void waitForEmptyEventQueue() throws Exception { - EventQueue.invokeAndWait(new Runnable() { - @Override - public void run() { - // nothing to do, we're just waiting here for the event queue to be emptied - } - }); - } - } } diff --git a/rxjava-contrib/rxjava-swing/src/main/java/rx/schedulers/SwingScheduler.java b/rxjava-contrib/rxjava-swing/src/main/java/rx/schedulers/SwingScheduler.java new file mode 100644 index 00000000000..7ce2c4e2d17 --- /dev/null +++ b/rxjava-contrib/rxjava-swing/src/main/java/rx/schedulers/SwingScheduler.java @@ -0,0 +1,274 @@ +/** + * 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.schedulers; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.awt.EventQueue; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import javax.swing.SwingUtilities; +import javax.swing.Timer; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.InOrder; + +import rx.Scheduler; +import rx.Subscription; +import rx.subscriptions.CompositeSubscription; +import rx.subscriptions.Subscriptions; +import rx.util.functions.Action0; +import rx.util.functions.Func2; + +/** + * Executes work on the Swing UI thread. + * This scheduler should only be used with actions that execute quickly. + */ +public final class SwingScheduler extends Scheduler { + private static final SwingScheduler INSTANCE = new SwingScheduler(); + + public static SwingScheduler getInstance() { + return INSTANCE; + } + + private SwingScheduler() { + } + + @Override + public Subscription schedule(final T state, final Func2 action) { + final AtomicReference sub = new AtomicReference(); + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + sub.set(action.call(SwingScheduler.this, state)); + } + }); + return Subscriptions.create(new Action0() { + @Override + public void call() { + Subscription subscription = sub.get(); + if (subscription != null) { + subscription.unsubscribe(); + } + } + }); + } + + @Override + public Subscription schedule(final T state, final Func2 action, long dueTime, TimeUnit unit) { + final AtomicReference sub = new AtomicReference(); + long delay = unit.toMillis(dueTime); + assertThatTheDelayIsValidForTheSwingTimer(delay); + + class ExecuteOnceAction implements ActionListener { + private Timer timer; + + private void setTimer(Timer timer) { + this.timer = timer; + } + + @Override + public void actionPerformed(ActionEvent e) { + timer.stop(); + sub.set(action.call(SwingScheduler.this, state)); + } + } + + ExecuteOnceAction executeOnce = new ExecuteOnceAction(); + final Timer timer = new Timer((int) delay, executeOnce); + executeOnce.setTimer(timer); + timer.start(); + + return Subscriptions.create(new Action0() { + @Override + public void call() { + timer.stop(); + + Subscription subscription = sub.get(); + if (subscription != null) { + subscription.unsubscribe(); + } + } + }); + } + + @Override + public Subscription schedulePeriodically(T state, final Func2 action, long initialDelay, long period, TimeUnit unit) { + final AtomicReference timer = new AtomicReference(); + + final long delay = unit.toMillis(period); + assertThatTheDelayIsValidForTheSwingTimer(delay); + + final CompositeSubscription subscriptions = new CompositeSubscription(); + final Func2 initialAction = new Func2() { + @Override + public Subscription call(final Scheduler scheduler, final T state0) { + // start timer for periodic execution, collect subscriptions + timer.set(new Timer((int) delay, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + subscriptions.add(action.call(scheduler, state0)); + } + })); + timer.get().start(); + + return action.call(scheduler, state0); + } + }; + subscriptions.add(schedule(state, initialAction, initialDelay, unit)); + + subscriptions.add(Subscriptions.create(new Action0() { + @Override + public void call() { + // in addition to all the individual unsubscriptions, stop the timer on unsubscribing + Timer maybeTimer = timer.get(); + if (maybeTimer != null) { + maybeTimer.stop(); + } + } + })); + + return subscriptions; + } + + private static void assertThatTheDelayIsValidForTheSwingTimer(long delay) { + if (delay < 0 || delay > Integer.MAX_VALUE) { + throw new IllegalArgumentException(String.format("The swing timer only accepts non-negative delays up to %d milliseconds.", Integer.MAX_VALUE)); + } + } + + public static class UnitTest { + @Rule + public ExpectedException exception = ExpectedException.none(); + + @Test + public void testInvalidDelayValues() { + final SwingScheduler scheduler = new SwingScheduler(); + final Action0 action = mock(Action0.class); + + exception.expect(IllegalArgumentException.class); + scheduler.schedulePeriodically(action, -1L, 100L, TimeUnit.SECONDS); + + exception.expect(IllegalArgumentException.class); + scheduler.schedulePeriodically(action, 100L, -1L, TimeUnit.SECONDS); + + exception.expect(IllegalArgumentException.class); + scheduler.schedulePeriodically(action, 1L + Integer.MAX_VALUE, 100L, TimeUnit.MILLISECONDS); + + exception.expect(IllegalArgumentException.class); + scheduler.schedulePeriodically(action, 100L, 1L + Integer.MAX_VALUE / 1000, TimeUnit.SECONDS); + } + + @Test + public void testPeriodicScheduling() throws Exception { + final SwingScheduler scheduler = new SwingScheduler(); + + final CountDownLatch latch = new CountDownLatch(4); + + final Action0 innerAction = mock(Action0.class); + final Action0 action = new Action0() { + @Override + public void call() { + try { + innerAction.call(); + assertTrue(SwingUtilities.isEventDispatchThread()); + } finally { + latch.countDown(); + } + } + }; + + Subscription sub = scheduler.schedulePeriodically(action, 50, 200, TimeUnit.MILLISECONDS); + + if (!latch.await(5000, TimeUnit.MILLISECONDS)) { + fail("timed out waiting for tasks to execute"); + } + + sub.unsubscribe(); + waitForEmptyEventQueue(); + verify(innerAction, times(4)).call(); + } + + @Test + public void testNestedActions() throws Exception { + final SwingScheduler scheduler = new SwingScheduler(); + + final Action0 firstStepStart = mock(Action0.class); + final Action0 firstStepEnd = mock(Action0.class); + + final Action0 secondStepStart = mock(Action0.class); + final Action0 secondStepEnd = mock(Action0.class); + + final Action0 thirdStepStart = mock(Action0.class); + final Action0 thirdStepEnd = mock(Action0.class); + + final Action0 firstAction = new Action0() { + @Override + public void call() { + assertTrue(SwingUtilities.isEventDispatchThread()); + firstStepStart.call(); + firstStepEnd.call(); + } + }; + final Action0 secondAction = new Action0() { + @Override + public void call() { + assertTrue(SwingUtilities.isEventDispatchThread()); + secondStepStart.call(); + scheduler.schedule(firstAction); + secondStepEnd.call(); + } + }; + final Action0 thirdAction = new Action0() { + @Override + public void call() { + assertTrue(SwingUtilities.isEventDispatchThread()); + thirdStepStart.call(); + scheduler.schedule(secondAction); + thirdStepEnd.call(); + } + }; + + InOrder inOrder = inOrder(firstStepStart, firstStepEnd, secondStepStart, secondStepEnd, thirdStepStart, thirdStepEnd); + + scheduler.schedule(thirdAction); + waitForEmptyEventQueue(); + + inOrder.verify(thirdStepStart, times(1)).call(); + inOrder.verify(thirdStepEnd, times(1)).call(); + inOrder.verify(secondStepStart, times(1)).call(); + inOrder.verify(secondStepEnd, times(1)).call(); + inOrder.verify(firstStepStart, times(1)).call(); + inOrder.verify(firstStepEnd, times(1)).call(); + } + + private static void waitForEmptyEventQueue() throws Exception { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + // nothing to do, we're just waiting here for the event queue to be emptied + } + }); + } + } +} diff --git a/rxjava-core/src/test/java/rx/concurrency/SchedulerUnsubscribeTest.java b/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java similarity index 100% rename from rxjava-core/src/test/java/rx/concurrency/SchedulerUnsubscribeTest.java rename to rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java From 9ae04fde0e8035c1d0a0eaf7b7cb1eb2f2bfccba Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:52:48 -0800 Subject: [PATCH 5/6] Migrate code to use rx.schedulers instead of rx.concurrency Unit tests passed before and after (did change in multiple steps to assert unit test pass against rx.concurrency before migrating to rx.schedulers). --- .../src/test/groovy/rx/lang/groovy/TestParallel.groovy | 2 +- .../src/main/scala/rx/lang/scala/Scheduler.scala | 10 +++++----- .../lang/scala/schedulers/CurrentThreadScheduler.scala | 2 +- .../rx/lang/scala/schedulers/ExecutorScheduler.scala | 2 +- .../rx/lang/scala/schedulers/ImmediateScheduler.scala | 2 +- .../rx/lang/scala/schedulers/NewThreadScheduler.scala | 2 +- .../schedulers/ScheduledExecutorServiceScheduler.scala | 2 +- .../scala/rx/lang/scala/schedulers/TestScheduler.scala | 4 ++-- .../schedulers/ThreadPoolForComputationScheduler.scala | 2 +- .../scala/schedulers/ThreadPoolForIOScheduler.scala | 2 +- rxjava-core/src/test/java/rx/EventStream.java | 2 +- rxjava-core/src/test/java/rx/ObservableTests.java | 2 +- rxjava-core/src/test/java/rx/ObserveOnTests.java | 2 +- rxjava-core/src/test/java/rx/RefCountTests.java | 2 +- rxjava-core/src/test/java/rx/SchedulersTest.java | 4 ++-- rxjava-core/src/test/java/rx/ThrottleFirstTests.java | 2 +- rxjava-core/src/test/java/rx/ThrottleLastTests.java | 2 +- .../src/test/java/rx/ThrottleWithTimeoutTests.java | 2 +- rxjava-core/src/test/java/rx/TimeoutTests.java | 2 +- .../src/test/java/rx/operators/OperationAmbTest.java | 2 +- .../test/java/rx/operators/OperationBufferTest.java | 2 +- .../test/java/rx/operators/OperationConcatTest.java | 2 +- .../test/java/rx/operators/OperationDebounceTest.java | 2 +- .../src/test/java/rx/operators/OperationDelayTest.java | 2 +- .../test/java/rx/operators/OperationDoOnEachTest.java | 2 +- .../test/java/rx/operators/OperationIntervalTest.java | 2 +- .../src/test/java/rx/operators/OperationMapTest.java | 2 +- .../src/test/java/rx/operators/OperationNextTest.java | 2 +- .../test/java/rx/operators/OperationObserveOnTest.java | 4 ++-- .../test/java/rx/operators/OperationSampleTest.java | 2 +- .../java/rx/operators/OperationSubscribeOnTest.java | 2 +- .../test/java/rx/operators/OperationSwitchTest.java | 2 +- .../java/rx/operators/OperationThrottleFirstTest.java | 2 +- .../java/rx/operators/OperationTimeIntervalTest.java | 2 +- .../test/java/rx/operators/OperationTimestampTest.java | 2 +- .../test/java/rx/operators/OperationWindowTest.java | 2 +- .../java/rx/schedulers/SchedulerUnsubscribeTest.java | 3 ++- .../src/test/java/rx/util/functions/AsyncTest.java | 2 +- 38 files changed, 46 insertions(+), 45 deletions(-) diff --git a/language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/TestParallel.groovy b/language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/TestParallel.groovy index 509b7b0ca54..a54241b1607 100644 --- a/language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/TestParallel.groovy +++ b/language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/TestParallel.groovy @@ -19,7 +19,7 @@ import org.junit.Test import rx.Observable import rx.Scheduler -import rx.concurrency.Schedulers +import rx.schedulers.Schedulers import rx.util.functions.Func1 class TestParallel { diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala index 8b4edde4fa7..ead8054279f 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala @@ -204,11 +204,11 @@ trait Scheduler { private [scala] object Scheduler { def apply(scheduler: rx.Scheduler): Scheduler = scheduler match { - case s: rx.concurrency.CurrentThreadScheduler => new CurrentThreadScheduler(s) - case s: rx.concurrency.ExecutorScheduler => new ExecutorScheduler(s) - case s: rx.concurrency.ImmediateScheduler => new ImmediateScheduler(s) - case s: rx.concurrency.NewThreadScheduler => new NewThreadScheduler(s) - case s: rx.concurrency.TestScheduler => new TestScheduler(s) + case s: rx.schedulers.CurrentThreadScheduler => new CurrentThreadScheduler(s) + case s: rx.schedulers.ExecutorScheduler => new ExecutorScheduler(s) + case s: rx.schedulers.ImmediateScheduler => new ImmediateScheduler(s) + case s: rx.schedulers.NewThreadScheduler => new NewThreadScheduler(s) + case s: rx.schedulers.TestScheduler => new TestScheduler(s) case s: rx.Scheduler => new Scheduler{ val asJavaScheduler = s } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/CurrentThreadScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/CurrentThreadScheduler.scala index f3a7898a30c..688b1e86caa 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/CurrentThreadScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/CurrentThreadScheduler.scala @@ -23,7 +23,7 @@ object CurrentThreadScheduler { * Returns a [[rx.lang.scala.Scheduler]] that queues work on the current thread to be executed after the current work completes. */ def apply(): CurrentThreadScheduler = { - new CurrentThreadScheduler(rx.concurrency.Schedulers.currentThread()) + new CurrentThreadScheduler(rx.schedulers.Schedulers.currentThread()) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ExecutorScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ExecutorScheduler.scala index d718c58b55f..72287939e8d 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ExecutorScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ExecutorScheduler.scala @@ -26,7 +26,7 @@ object ExecutorScheduler { * Note that this does not support scheduled actions with a delay. */ def apply(executor: Executor): ExecutorScheduler = { - new ExecutorScheduler(rx.concurrency.Schedulers.executor(executor)) + new ExecutorScheduler(rx.schedulers.Schedulers.executor(executor)) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ImmediateScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ImmediateScheduler.scala index 7a066a39314..cc22456afaa 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ImmediateScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ImmediateScheduler.scala @@ -23,7 +23,7 @@ object ImmediateScheduler { * Returns a [[rx.lang.scala.Scheduler]] that executes work immediately on the current thread. */ def apply(): ImmediateScheduler = { - new ImmediateScheduler(rx.concurrency.Schedulers.immediate()) + new ImmediateScheduler(rx.schedulers.Schedulers.immediate()) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/NewThreadScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/NewThreadScheduler.scala index 674205ba07f..19550359811 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/NewThreadScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/NewThreadScheduler.scala @@ -23,7 +23,7 @@ object NewThreadScheduler { * Returns a [[rx.lang.scala.Scheduler]] that creates a new {@link Thread} for each unit of work. */ def apply(): NewThreadScheduler = { - new NewThreadScheduler(rx.concurrency.Schedulers.newThread()) + new NewThreadScheduler(rx.schedulers.Schedulers.newThread()) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ScheduledExecutorServiceScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ScheduledExecutorServiceScheduler.scala index 20c4dc3544c..8f64bb4f84a 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ScheduledExecutorServiceScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ScheduledExecutorServiceScheduler.scala @@ -24,7 +24,7 @@ object ScheduledExecutorServiceScheduler { * Returns a [[rx.lang.scala.Scheduler]] that queues work on an `java.util.concurrent.ScheduledExecutorService`. */ def apply(executor: ScheduledExecutorService): ScheduledExecutorServiceScheduler = { - new ScheduledExecutorServiceScheduler(rx.concurrency.Schedulers.executor(executor)) + new ScheduledExecutorServiceScheduler(rx.schedulers.Schedulers.executor(executor)) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/TestScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/TestScheduler.scala index f8df7610b87..3d853f87e91 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/TestScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/TestScheduler.scala @@ -23,7 +23,7 @@ import rx.lang.scala.Scheduler */ object TestScheduler { def apply(): TestScheduler = { - new TestScheduler(new rx.concurrency.TestScheduler()) + new TestScheduler(new rx.schedulers.TestScheduler()) } } @@ -64,7 +64,7 @@ object TestScheduler { * } * }}} */ -class TestScheduler private[scala] (val asJavaScheduler: rx.concurrency.TestScheduler) extends Scheduler { +class TestScheduler private[scala] (val asJavaScheduler: rx.schedulers.TestScheduler) extends Scheduler { def advanceTimeBy(time: Duration) { asJavaScheduler.advanceTimeBy(time.length, time.unit) diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForComputationScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForComputationScheduler.scala index b9e0791befa..38e321bc047 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForComputationScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForComputationScheduler.scala @@ -29,7 +29,7 @@ object ThreadPoolForComputationScheduler { * Do not perform IO-bound work on this scheduler. Use [[rx.lang.scala.schedulers.ThreadPoolForIOScheduler]] instead. */ def apply(): ThreadPoolForComputationScheduler = { - new ThreadPoolForComputationScheduler(rx.concurrency.Schedulers.threadPoolForComputation()) + new ThreadPoolForComputationScheduler(rx.schedulers.Schedulers.threadPoolForComputation()) } } diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForIOScheduler.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForIOScheduler.scala index 63b7e6b6596..e3fef920805 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForIOScheduler.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForIOScheduler.scala @@ -29,7 +29,7 @@ object ThreadPoolForIOScheduler { * Do not perform computational work on this scheduler. Use [[rx.lang.scala.schedulers.ThreadPoolForComputationScheduler]] instead. */ def apply(): ThreadPoolForIOScheduler = { - new ThreadPoolForIOScheduler(rx.concurrency.Schedulers.threadPoolForIO()) + new ThreadPoolForIOScheduler(rx.schedulers.Schedulers.threadPoolForIO()) } } diff --git a/rxjava-core/src/test/java/rx/EventStream.java b/rxjava-core/src/test/java/rx/EventStream.java index f32787bac1e..f41e670923e 100644 --- a/rxjava-core/src/test/java/rx/EventStream.java +++ b/rxjava-core/src/test/java/rx/EventStream.java @@ -20,7 +20,7 @@ import java.util.Map; import rx.Observable.OnSubscribeFunc; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subscriptions.BooleanSubscription; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/ObservableTests.java b/rxjava-core/src/test/java/rx/ObservableTests.java index e4023f44ab2..43b81195af9 100644 --- a/rxjava-core/src/test/java/rx/ObservableTests.java +++ b/rxjava-core/src/test/java/rx/ObservableTests.java @@ -35,7 +35,7 @@ import org.mockito.MockitoAnnotations; import rx.Observable.OnSubscribeFunc; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.observables.ConnectableObservable; import rx.subscriptions.BooleanSubscription; import rx.subscriptions.Subscriptions; diff --git a/rxjava-core/src/test/java/rx/ObserveOnTests.java b/rxjava-core/src/test/java/rx/ObserveOnTests.java index 57d13c35851..3f9e474787c 100644 --- a/rxjava-core/src/test/java/rx/ObserveOnTests.java +++ b/rxjava-core/src/test/java/rx/ObserveOnTests.java @@ -21,7 +21,7 @@ import org.junit.Test; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Action1; import rx.util.functions.Func1; diff --git a/rxjava-core/src/test/java/rx/RefCountTests.java b/rxjava-core/src/test/java/rx/RefCountTests.java index b83e94fcae3..3f02933a800 100644 --- a/rxjava-core/src/test/java/rx/RefCountTests.java +++ b/rxjava-core/src/test/java/rx/RefCountTests.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.mockito.MockitoAnnotations; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; import rx.util.functions.Action1; diff --git a/rxjava-core/src/test/java/rx/SchedulersTest.java b/rxjava-core/src/test/java/rx/SchedulersTest.java index c9d97054d08..62e74f5798b 100644 --- a/rxjava-core/src/test/java/rx/SchedulersTest.java +++ b/rxjava-core/src/test/java/rx/SchedulersTest.java @@ -31,8 +31,8 @@ import org.mockito.Mockito; import rx.Observable.OnSubscribeFunc; -import rx.concurrency.Schedulers; -import rx.concurrency.TestScheduler; +import rx.schedulers.Schedulers; +import rx.schedulers.TestScheduler; import rx.subscriptions.BooleanSubscription; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/ThrottleFirstTests.java b/rxjava-core/src/test/java/rx/ThrottleFirstTests.java index 655754d398e..bbba4214774 100644 --- a/rxjava-core/src/test/java/rx/ThrottleFirstTests.java +++ b/rxjava-core/src/test/java/rx/ThrottleFirstTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.mockito.InOrder; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; public class ThrottleFirstTests { diff --git a/rxjava-core/src/test/java/rx/ThrottleLastTests.java b/rxjava-core/src/test/java/rx/ThrottleLastTests.java index c3a037a78c8..94ec7051b28 100644 --- a/rxjava-core/src/test/java/rx/ThrottleLastTests.java +++ b/rxjava-core/src/test/java/rx/ThrottleLastTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.mockito.InOrder; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; public class ThrottleLastTests { diff --git a/rxjava-core/src/test/java/rx/ThrottleWithTimeoutTests.java b/rxjava-core/src/test/java/rx/ThrottleWithTimeoutTests.java index ead4ddb24e8..2e27c81cce8 100644 --- a/rxjava-core/src/test/java/rx/ThrottleWithTimeoutTests.java +++ b/rxjava-core/src/test/java/rx/ThrottleWithTimeoutTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.mockito.InOrder; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; public class ThrottleWithTimeoutTests { diff --git a/rxjava-core/src/test/java/rx/TimeoutTests.java b/rxjava-core/src/test/java/rx/TimeoutTests.java index 46a3620ce5e..144824d2228 100644 --- a/rxjava-core/src/test/java/rx/TimeoutTests.java +++ b/rxjava-core/src/test/java/rx/TimeoutTests.java @@ -30,7 +30,7 @@ import org.mockito.InOrder; import org.mockito.MockitoAnnotations; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; public class TimeoutTests { diff --git a/rxjava-core/src/test/java/rx/operators/OperationAmbTest.java b/rxjava-core/src/test/java/rx/operators/OperationAmbTest.java index 784d6861985..f6e5cd859cc 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationAmbTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationAmbTest.java @@ -29,7 +29,7 @@ import rx.Observable.OnSubscribeFunc; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.CompositeSubscription; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/operators/OperationBufferTest.java b/rxjava-core/src/test/java/rx/operators/OperationBufferTest.java index a2de69ed63e..dc45a16a8f1 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationBufferTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationBufferTest.java @@ -34,7 +34,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; import rx.util.functions.Action1; diff --git a/rxjava-core/src/test/java/rx/operators/OperationConcatTest.java b/rxjava-core/src/test/java/rx/operators/OperationConcatTest.java index 0f3f8f88669..24146ec131d 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationConcatTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationConcatTest.java @@ -32,7 +32,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.BooleanSubscription; public class OperationConcatTest { diff --git a/rxjava-core/src/test/java/rx/operators/OperationDebounceTest.java b/rxjava-core/src/test/java/rx/operators/OperationDebounceTest.java index e831c7b8296..9779239f956 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationDebounceTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationDebounceTest.java @@ -27,7 +27,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java b/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java index 224a82be553..118094bffba 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java @@ -18,7 +18,7 @@ import rx.Observable; import rx.Observer; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.util.functions.Func1; public class OperationDelayTest { diff --git a/rxjava-core/src/test/java/rx/operators/OperationDoOnEachTest.java b/rxjava-core/src/test/java/rx/operators/OperationDoOnEachTest.java index 6c1407ebeaf..e1e72a249a4 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationDoOnEachTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationDoOnEachTest.java @@ -33,7 +33,7 @@ import rx.Observable; import rx.Observer; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Func1; import rx.util.functions.Func2; import rx.util.functions.Action1; diff --git a/rxjava-core/src/test/java/rx/operators/OperationIntervalTest.java b/rxjava-core/src/test/java/rx/operators/OperationIntervalTest.java index 293ff236c9c..23c786fc895 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationIntervalTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationIntervalTest.java @@ -27,7 +27,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.observables.ConnectableObservable; public class OperationIntervalTest { diff --git a/rxjava-core/src/test/java/rx/operators/OperationMapTest.java b/rxjava-core/src/test/java/rx/operators/OperationMapTest.java index 175cd66f752..463b2dca7a2 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationMapTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationMapTest.java @@ -33,7 +33,7 @@ import rx.Observable; import rx.Observer; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Func1; import rx.util.functions.Func2; diff --git a/rxjava-core/src/test/java/rx/operators/OperationNextTest.java b/rxjava-core/src/test/java/rx/operators/OperationNextTest.java index 140cc0560c2..8a5de26d1d8 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationNextTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationNextTest.java @@ -30,7 +30,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.subjects.PublishSubject; import rx.subjects.Subject; import rx.subscriptions.Subscriptions; diff --git a/rxjava-core/src/test/java/rx/operators/OperationObserveOnTest.java b/rxjava-core/src/test/java/rx/operators/OperationObserveOnTest.java index 63fa0e4f279..69fa6b1718f 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationObserveOnTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationObserveOnTest.java @@ -30,8 +30,8 @@ import rx.Observable; import rx.Observer; -import rx.concurrency.Schedulers; -import rx.concurrency.TestScheduler; +import rx.schedulers.Schedulers; +import rx.schedulers.TestScheduler; import rx.util.functions.Action1; public class OperationObserveOnTest { diff --git a/rxjava-core/src/test/java/rx/operators/OperationSampleTest.java b/rxjava-core/src/test/java/rx/operators/OperationSampleTest.java index 18316889c13..58c98895ec9 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationSampleTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationSampleTest.java @@ -26,7 +26,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/operators/OperationSubscribeOnTest.java b/rxjava-core/src/test/java/rx/operators/OperationSubscribeOnTest.java index 635d4d8755f..3f605abf97e 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationSubscribeOnTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationSubscribeOnTest.java @@ -25,7 +25,7 @@ import rx.Observer; import rx.Scheduler; import rx.Subscription; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.test.OperatorTester; import rx.util.functions.Action0; import rx.util.functions.Func2; diff --git a/rxjava-core/src/test/java/rx/operators/OperationSwitchTest.java b/rxjava-core/src/test/java/rx/operators/OperationSwitchTest.java index fa38f02ff86..8afa5557f13 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationSwitchTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationSwitchTest.java @@ -27,7 +27,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/operators/OperationThrottleFirstTest.java b/rxjava-core/src/test/java/rx/operators/OperationThrottleFirstTest.java index ad58e136047..682f0305297 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationThrottleFirstTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationThrottleFirstTest.java @@ -27,7 +27,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; diff --git a/rxjava-core/src/test/java/rx/operators/OperationTimeIntervalTest.java b/rxjava-core/src/test/java/rx/operators/OperationTimeIntervalTest.java index 056b97bf118..c71ade0166f 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationTimeIntervalTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationTimeIntervalTest.java @@ -27,7 +27,7 @@ import rx.Observable; import rx.Observer; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; import rx.util.TimeInterval; diff --git a/rxjava-core/src/test/java/rx/operators/OperationTimestampTest.java b/rxjava-core/src/test/java/rx/operators/OperationTimestampTest.java index 9794b6c7f58..90baedd3dc1 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationTimestampTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationTimestampTest.java @@ -24,7 +24,7 @@ import org.mockito.MockitoAnnotations; import rx.Observable; import rx.Observer; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subjects.PublishSubject; import rx.util.Timestamped; diff --git a/rxjava-core/src/test/java/rx/operators/OperationWindowTest.java b/rxjava-core/src/test/java/rx/operators/OperationWindowTest.java index 6eff5828786..180179a9021 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationWindowTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationWindowTest.java @@ -28,7 +28,7 @@ import rx.Observable; import rx.Observer; import rx.Subscription; -import rx.concurrency.TestScheduler; +import rx.schedulers.TestScheduler; import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; import rx.util.functions.Action1; diff --git a/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java b/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java index a89da84304f..123e22ac005 100644 --- a/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java +++ b/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java @@ -1,4 +1,4 @@ -package rx.concurrency; +package rx.schedulers; import static org.junit.Assert.*; @@ -11,6 +11,7 @@ import rx.Observable; import rx.Observer; import rx.Scheduler; +import rx.schedulers.Schedulers; import rx.operators.SafeObservableSubscription; import rx.util.functions.Func1; diff --git a/rxjava-core/src/test/java/rx/util/functions/AsyncTest.java b/rxjava-core/src/test/java/rx/util/functions/AsyncTest.java index cc761708942..05a75c4f855 100644 --- a/rxjava-core/src/test/java/rx/util/functions/AsyncTest.java +++ b/rxjava-core/src/test/java/rx/util/functions/AsyncTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.verify; import org.mockito.MockitoAnnotations; import rx.Observer; -import rx.concurrency.Schedulers; +import rx.schedulers.Schedulers; import rx.util.functions.Action0; import rx.util.functions.Action1; import rx.util.functions.Action2; From 7ba592402a485bded33cce2fec6f1abe4a98e58e Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Tue, 10 Dec 2013 15:55:19 -0800 Subject: [PATCH 6/6] Add Missing License Headers --- .../scala/examples/TestSchedulerExample.scala | 15 +++++++++++++++ .../scala/rx/lang/scala/JavaConversions.scala | 15 +++++++++++++++ .../rx/lang/scala/CompletenessTest.scala | 15 +++++++++++++++ .../scala/rx/lang/scala/ConstructorTest.scala | 15 +++++++++++++++ .../rx/lang/scala/NotificationTests.scala | 15 +++++++++++++++ .../scala/rx/lang/scala/ObservableTest.scala | 15 +++++++++++++++ .../scala/rx/lang/scala/SubjectTests.scala | 15 +++++++++++++++ .../rx/lang/scala/SubscriptionTests.scala | 15 +++++++++++++++ .../concurrency/AndroidSchedulers.java | 15 +++++++++++++++ .../concurrency/HandlerThreadScheduler.java | 15 +++++++++++++++ .../java/rx/observables/StringObservable.java | 15 +++++++++++++++ .../rx/observables/StringObservableTest.java | 15 +++++++++++++++ .../java/rx/concurrency/SwingScheduler.java | 15 +++++++++++++++ .../concurrency/CurrentThreadScheduler.java | 15 +++++++++++++++ .../rx/concurrency/ExecutorScheduler.java | 15 +++++++++++++++ .../rx/concurrency/ImmediateScheduler.java | 15 +++++++++++++++ .../rx/concurrency/NewThreadScheduler.java | 15 +++++++++++++++ .../main/java/rx/concurrency/Schedulers.java | 15 +++++++++++++++ .../java/rx/concurrency/TestScheduler.java | 15 +++++++++++++++ .../java/rx/operators/OperationDelayTest.java | 15 +++++++++++++++ .../rx/operators/OperationToMultimapTest.java | 19 ++++++++++++++----- .../operators/OperationZipTestCompletion.java | 15 +++++++++++++++ .../schedulers/SchedulerUnsubscribeTest.java | 15 +++++++++++++++ .../test/java/rx/util/AssertObservable.java | 15 +++++++++++++++ .../java/rx/util/AssertObservableTest.java | 15 +++++++++++++++ 25 files changed, 374 insertions(+), 5 deletions(-) diff --git a/language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/TestSchedulerExample.scala b/language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/TestSchedulerExample.scala index 2e53f1afe9a..a48b8acb51c 100644 --- a/language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/TestSchedulerExample.scala +++ b/language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/TestSchedulerExample.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala.examples import scala.concurrent.duration.DurationInt diff --git a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/JavaConversions.scala b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/JavaConversions.scala index cc380c463c2..f36dc6b6dd9 100644 --- a/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/JavaConversions.scala +++ b/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/JavaConversions.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala /** diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala index 41bbdca3479..d4778d7d5e5 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala import java.util.Calendar diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ConstructorTest.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ConstructorTest.scala index e2822405b24..6669db2f77f 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ConstructorTest.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ConstructorTest.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala import scala.language.postfixOps import org.junit.Assert._ diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/NotificationTests.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/NotificationTests.scala index 759ca8b7ecc..ea05faa9426 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/NotificationTests.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/NotificationTests.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ObservableTest.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ObservableTest.scala index 0b755833da7..39f863b4dd5 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ObservableTest.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ObservableTest.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala import scala.concurrent.{Future, Await} diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubjectTests.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubjectTests.scala index 50773d55820..f8d72e3520f 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubjectTests.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubjectTests.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala import org.junit.{Assert, Test} diff --git a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubscriptionTests.scala b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubscriptionTests.scala index 71ea4d4a6ef..b53d4fe2654 100644 --- a/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubscriptionTests.scala +++ b/language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubscriptionTests.scala @@ -1,3 +1,18 @@ +/** + * 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.lang.scala diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java index 982a80bdf6f..f0e42f0d6dc 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java @@ -1,3 +1,18 @@ +/** + * 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.android.concurrency; import rx.Scheduler; diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java index 8def41024f3..7c117ccf44d 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.android.concurrency; import android.os.Handler; diff --git a/rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java b/rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java index dfe7ca3e68f..3bdb58a8779 100644 --- a/rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java +++ b/rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java @@ -1,3 +1,18 @@ +/** + * 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.observables; import java.nio.ByteBuffer; diff --git a/rxjava-contrib/rxjava-string/src/test/java/rx/observables/StringObservableTest.java b/rxjava-contrib/rxjava-string/src/test/java/rx/observables/StringObservableTest.java index 8ced455f63e..86a686958c3 100644 --- a/rxjava-contrib/rxjava-string/src/test/java/rx/observables/StringObservableTest.java +++ b/rxjava-contrib/rxjava-string/src/test/java/rx/observables/StringObservableTest.java @@ -1,3 +1,18 @@ +/** + * 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.observables; import static org.junit.Assert.*; diff --git a/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java b/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java index c9fcb18a1f5..c6be1c55ece 100644 --- a/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java +++ b/rxjava-contrib/rxjava-swing/src/main/java/rx/concurrency/SwingScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java b/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java index ed905af3e5c..fe8ac26e0b4 100644 --- a/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/CurrentThreadScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java b/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java index ecfcddc2860..2833a2072e9 100644 --- a/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/ExecutorScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.Executor; diff --git a/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java b/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java index 001208d64c3..f3bdf8aa8fc 100644 --- a/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/ImmediateScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java b/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java index fac4aa1fe0c..a574442ba67 100644 --- a/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/NewThreadScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.TimeUnit; diff --git a/rxjava-core/src/main/java/rx/concurrency/Schedulers.java b/rxjava-core/src/main/java/rx/concurrency/Schedulers.java index a257d54e67b..cdc9e1f6a3f 100644 --- a/rxjava-core/src/main/java/rx/concurrency/Schedulers.java +++ b/rxjava-core/src/main/java/rx/concurrency/Schedulers.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; import java.util.concurrent.Executor; diff --git a/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java b/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java index fbf3e76b7d2..e402e1b63e9 100644 --- a/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/TestScheduler.java @@ -1,3 +1,18 @@ +/** + * 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.concurrency; /** diff --git a/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java b/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java index 118094bffba..538131731d5 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationDelayTest.java @@ -1,3 +1,18 @@ +/** + * 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.operators; import static org.mockito.Matchers.any; diff --git a/rxjava-core/src/test/java/rx/operators/OperationToMultimapTest.java b/rxjava-core/src/test/java/rx/operators/OperationToMultimapTest.java index b254d93d2e6..478f5f1da8f 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationToMultimapTest.java +++ b/rxjava-core/src/test/java/rx/operators/OperationToMultimapTest.java @@ -1,9 +1,18 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. +/** + * 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.operators; import java.util.ArrayList; import java.util.Arrays; diff --git a/rxjava-core/src/test/java/rx/operators/OperationZipTestCompletion.java b/rxjava-core/src/test/java/rx/operators/OperationZipTestCompletion.java index 3c0913f64d9..23baf7652c8 100644 --- a/rxjava-core/src/test/java/rx/operators/OperationZipTestCompletion.java +++ b/rxjava-core/src/test/java/rx/operators/OperationZipTestCompletion.java @@ -1,3 +1,18 @@ +/** + * 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.operators; import static org.mockito.Mockito.inOrder; diff --git a/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java b/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java index 123e22ac005..ec51d7f977e 100644 --- a/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java +++ b/rxjava-core/src/test/java/rx/schedulers/SchedulerUnsubscribeTest.java @@ -1,3 +1,18 @@ +/** + * 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.schedulers; import static org.junit.Assert.*; diff --git a/rxjava-core/src/test/java/rx/util/AssertObservable.java b/rxjava-core/src/test/java/rx/util/AssertObservable.java index 1bd34fcd239..196a12e92f8 100644 --- a/rxjava-core/src/test/java/rx/util/AssertObservable.java +++ b/rxjava-core/src/test/java/rx/util/AssertObservable.java @@ -1,3 +1,18 @@ +/** + * 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; import rx.Notification; diff --git a/rxjava-core/src/test/java/rx/util/AssertObservableTest.java b/rxjava-core/src/test/java/rx/util/AssertObservableTest.java index f2182bd8cfb..a67381e89f3 100644 --- a/rxjava-core/src/test/java/rx/util/AssertObservableTest.java +++ b/rxjava-core/src/test/java/rx/util/AssertObservableTest.java @@ -1,3 +1,18 @@ +/** + * 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; import org.junit.Test;