Search in sources :

Example 1 with Completable

use of rx.Completable in project azure-sdk-for-java by Azure.

the class SqlServerImpl method deleteChildResources.

private void deleteChildResources() {
    Completable deleteFirewallRules = deleteFirewallRule();
    Completable deleteDatabasesAndElasticPools = deleteDatabasesAndElasticPools();
    Completable.merge(deleteFirewallRules, deleteDatabasesAndElasticPools).await();
}
Also used : Completable(rx.Completable)

Example 2 with Completable

use of rx.Completable in project azure-sdk-for-java by Azure.

the class SqlServerImpl method deleteDatabasesAndElasticPools.

private Completable deleteDatabasesAndElasticPools() {
    List<Completable> deleteDBList = new ArrayList<>();
    for (String databaseName : this.databasesToDelete) {
        deleteDBList.add(this.databases().deleteAsync(databaseName));
    }
    Completable deleteDBs = Completable.merge(deleteDBList);
    List<Completable> deleteElasticPoolList = new ArrayList<>();
    for (String elasticPoolName : this.elasticPoolsToDelete) {
        deleteElasticPoolList.add(this.elasticPools().deleteAsync(elasticPoolName));
    }
    Completable deletePools = Completable.merge(deleteElasticPoolList);
    return Completable.concat(deleteDBs, deletePools);
}
Also used : Completable(rx.Completable) ArrayList(java.util.ArrayList)

Example 3 with Completable

use of rx.Completable in project azure-sdk-for-java by Azure.

the class QueueImpl method createChildResourceAsync.

@Override
protected Observable<Queue> createChildResourceAsync() {
    Completable createQueueCompletable = this.manager().inner().queues().createOrUpdateAsync(this.resourceGroupName(), this.parentName, this.name(), this.inner()).map(new Func1<QueueInner, QueueInner>() {

        @Override
        public QueueInner call(QueueInner inner) {
            setInner(inner);
            return inner;
        }
    }).toCompletable();
    Completable childrenOperationsCompletable = submitChildrenOperationsAsync();
    final Queue self = this;
    return Completable.concat(createQueueCompletable, childrenOperationsCompletable).doOnTerminate(new Action0() {

        @Override
        public void call() {
            initChildrenOperationsCache();
        }
    }).andThen(Observable.just(self));
}
Also used : Completable(rx.Completable) Action0(rx.functions.Action0) Func1(rx.functions.Func1) Queue(com.microsoft.azure.management.servicebus.Queue)

Example 4 with Completable

use of rx.Completable in project storio by pushtorefresh.

the class DeleteOperationDesignTest method deleteObjectCompletable.

@Test
public void deleteObjectCompletable() {
    Article article = mock(Article.class);
    Completable completable = storIOContentResolver().delete().object(article).withDeleteResolver(ArticleMeta.DELETE_RESOLVER).prepare().asRxCompletable();
}
Also used : Completable(rx.Completable) Test(org.junit.Test)

Example 5 with Completable

use of rx.Completable in project storio by pushtorefresh.

the class DeleteOperationDesignTest method deleteByQueryCompletable.

@Test
public void deleteByQueryCompletable() {
    final DeleteQuery deleteQuery = DeleteQuery.builder().uri(mock(Uri.class)).where("some_field = ?").whereArgs("someValue").build();
    Completable completable = storIOContentResolver().delete().byQuery(deleteQuery).prepare().asRxCompletable();
}
Also used : Completable(rx.Completable) DeleteQuery(com.pushtorefresh.storio.contentresolver.queries.DeleteQuery) Test(org.junit.Test)

Aggregations

Completable (rx.Completable)42 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)6 TestSubscriber (rx.observers.TestSubscriber)6 MockResponse (okhttp3.mockwebserver.MockResponse)4 Func1 (rx.functions.Func1)4 ContentValues (android.content.ContentValues)3 Action0 (rx.functions.Action0)3 CheckResult (android.support.annotation.CheckResult)2 NonNull (android.support.annotation.NonNull)2 BasicHystrixTest (com.netflix.hystrix.contrib.javanica.test.common.BasicHystrixTest)2 User (com.netflix.hystrix.contrib.javanica.test.common.domain.User)2 PreparedWriteOperation (com.pushtorefresh.storio.operations.PreparedWriteOperation)2 OnSubscribeExecuteAsBlockingCompletable (com.pushtorefresh.storio.operations.internal.OnSubscribeExecuteAsBlockingCompletable)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 InvalidDataAccessApiUsageException (org.springframework.dao.InvalidDataAccessApiUsageException)2 Mono (reactor.core.publisher.Mono)2 CloudException (com.microsoft.azure.CloudException)1 Network (com.microsoft.azure.management.network.Network)1 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)1