@Test public void isMaxStrategyworks() throws Exception { rxDownloader = builder .strategy(DownloadStrategy.MAX) .addFile("http: .build(); List<FileContainer> res = rxDownloader.asList().blockingGet(); res.forEach(fileContainer -> { Log.i("RxDownloader", "key" + fileContainer.getFilename() + ",value " + fileContainer.getUrl()); }); assertNotEquals(res.size(), 0); Assert.assertEquals(res.size(), 3); }
public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()); if (ORDER == DownloadStrategy.FLAG_PARALLEL) observable = parallelDownloading(observable); else if (ORDER == DownloadStrategy.FLAG_SEQUENTIAL) observable = sequentialDownloading(observable); return observable.toList(); }
RxDownloader { public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()); if (ORDER == DownloadStrategy.FLAG_PARALLEL) observable = parallelDownloading(observable); else if (ORDER == DownloadStrategy.FLAG_SEQUENTIAL) observable = sequentialDownloading(observable); return observable.toList(); } }
RxDownloader { public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()); if (ORDER == DownloadStrategy.FLAG_PARALLEL) observable = parallelDownloading(observable); else if (ORDER == DownloadStrategy.FLAG_SEQUENTIAL) observable = sequentialDownloading(observable); return observable.toList(); } RxDownloader(final Builder builder); }
RxDownloader { public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()); if (ORDER == DownloadStrategy.FLAG_PARALLEL) observable = parallelDownloading(observable); else if (ORDER == DownloadStrategy.FLAG_SEQUENTIAL) observable = sequentialDownloading(observable); return observable.toList(); } RxDownloader(final Builder builder); RxDownloader doOnEachSingleError(OnError action); RxDownloader doOnStart(OnStart action); RxDownloader doOnCompleteWithSuccess(OnCompleteWithSuccess action); RxDownloader doOnCompleteWithError(OnCompleteWithError action); RxDownloader doOnProgress(OnProgress action); Single<List<FileContainer>> asList(); }
RxDownloader { public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()); if (ORDER == DownloadStrategy.FLAG_PARALLEL) observable = parallelDownloading(observable); else if (ORDER == DownloadStrategy.FLAG_SEQUENTIAL) observable = sequentialDownloading(observable); return observable.toList(); } RxDownloader(final Builder builder); RxDownloader doOnEachSingleError(OnError action); RxDownloader doOnStart(OnStart action); RxDownloader doOnCompleteWithSuccess(OnCompleteWithSuccess action); RxDownloader doOnCompleteWithError(OnCompleteWithError action); RxDownloader doOnProgress(OnProgress action); Single<List<FileContainer>> asList(); static String TAG; }