Search in sources :

Example 1 with ObservableTransformer

use of io.reactivex.ObservableTransformer in project sqlbrite by square.

the class BriteDatabaseTest method setUp.

@Before
public void setUp() throws IOException {
    Configuration configuration = Configuration.builder(InstrumentationRegistry.getContext()).callback(testDb).name(dbFolder.newFile().getPath()).build();
    Factory factory = new FrameworkSQLiteOpenHelperFactory();
    SupportSQLiteOpenHelper helper = factory.create(configuration);
    real = helper.getWritableDatabase();
    SqlBrite.Logger logger = new SqlBrite.Logger() {

        @Override
        public void log(String message) {
            logs.add(message);
        }
    };
    ObservableTransformer<Query, Query> queryTransformer = new ObservableTransformer<Query, Query>() {

        @Override
        public ObservableSource<Query> apply(Observable<Query> upstream) {
            return upstream.takeUntil(killSwitch);
        }
    };
    db = new BriteDatabase(helper, logger, scheduler, queryTransformer);
}
Also used : Configuration(android.arch.persistence.db.SupportSQLiteOpenHelper.Configuration) Query(com.squareup.sqlbrite3.SqlBrite.Query) SimpleSQLiteQuery(android.arch.persistence.db.SimpleSQLiteQuery) Factory(android.arch.persistence.db.SupportSQLiteOpenHelper.Factory) FrameworkSQLiteOpenHelperFactory(android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory) Observable(io.reactivex.Observable) FrameworkSQLiteOpenHelperFactory(android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory) SupportSQLiteOpenHelper(android.arch.persistence.db.SupportSQLiteOpenHelper) ObservableTransformer(io.reactivex.ObservableTransformer) Before(org.junit.Before)

Aggregations

SimpleSQLiteQuery (android.arch.persistence.db.SimpleSQLiteQuery)1 SupportSQLiteOpenHelper (android.arch.persistence.db.SupportSQLiteOpenHelper)1 Configuration (android.arch.persistence.db.SupportSQLiteOpenHelper.Configuration)1 Factory (android.arch.persistence.db.SupportSQLiteOpenHelper.Factory)1 FrameworkSQLiteOpenHelperFactory (android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory)1 Query (com.squareup.sqlbrite3.SqlBrite.Query)1 Observable (io.reactivex.Observable)1 ObservableTransformer (io.reactivex.ObservableTransformer)1 Before (org.junit.Before)1