use of rx.Completable in project azure-sdk-for-java by Azure.
the class ServiceBusNamespaceImpl method createResourceAsync.
@Override
public Observable<ServiceBusNamespace> createResourceAsync() {
Completable createNamespaceCompletable = this.manager().inner().namespaces().createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()).map(new Func1<NamespaceInner, NamespaceInner>() {
@Override
public NamespaceInner call(NamespaceInner inner) {
setInner(inner);
return inner;
}
}).toCompletable();
Completable childrenOperationsCompletable = submitChildrenOperationsAsync();
final ServiceBusNamespace self = this;
return Completable.concat(createNamespaceCompletable, childrenOperationsCompletable).doOnTerminate(new Action0() {
@Override
public void call() {
initChildrenOperationsCache();
}
}).andThen(Observable.just(self));
}
use of rx.Completable in project azure-sdk-for-java by Azure.
the class TopicImpl method createChildResourceAsync.
@Override
protected Observable<Topic> createChildResourceAsync() {
Completable createTopicCompletable = this.manager().inner().topics().createOrUpdateAsync(this.resourceGroupName(), this.parentName, this.name(), this.inner()).map(new Func1<TopicInner, TopicInner>() {
@Override
public TopicInner call(TopicInner inner) {
setInner(inner);
return inner;
}
}).toCompletable();
Completable childrenOperationsCompletable = submitChildrenOperationsAsync();
final Topic self = this;
return Completable.concat(createTopicCompletable, childrenOperationsCompletable).doOnTerminate(new Action0() {
@Override
public void call() {
initChildrenOperationsCache();
}
}).andThen(Observable.just(self));
}
use of rx.Completable in project storio by pushtorefresh.
the class RxJavaUtils method createCompletable.
@CheckResult
@NonNull
public static <T> Completable createCompletable(@NonNull StorIOContentResolver storIOContentResolver, @NonNull PreparedOperation<T> operation) {
throwExceptionIfRxJavaIsNotAvailable("asRxCompletable()");
final Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(operation));
return subscribeOn(storIOContentResolver, completable);
}
use of rx.Completable in project storio by pushtorefresh.
the class OnSubscribeExecuteAsBlockingCompletableTest method shouldExecuteAsBlockingAfterSubscription.
@SuppressWarnings("ResourceType")
@Test
public void shouldExecuteAsBlockingAfterSubscription() {
final PreparedWriteOperation preparedOperation = mock(PreparedWriteOperation.class);
TestSubscriber testSubscriber = new TestSubscriber();
verifyZeroInteractions(preparedOperation);
Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(preparedOperation));
verifyZeroInteractions(preparedOperation);
completable.subscribe(testSubscriber);
testSubscriber.assertNoErrors();
testSubscriber.assertCompleted();
verify(preparedOperation).executeAsBlocking();
verify(preparedOperation, never()).asRxObservable();
verify(preparedOperation, never()).asRxSingle();
verify(preparedOperation, never()).asRxCompletable();
}
use of rx.Completable in project storio by pushtorefresh.
the class DeleteOperationDesignTest method deleteObjectsCompletable.
@Test
public void deleteObjectsCompletable() {
final List<Article> articles = new ArrayList<Article>();
Completable completable = storIOContentResolver().delete().objects(articles).withDeleteResolver(ArticleMeta.DELETE_RESOLVER).prepare().asRxCompletable();
}
Aggregations