Search in sources :

Example 1 with Platform

use of io.requery.sql.Platform in project requery by requery.

the class RxTest method setup.

@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;
    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setWriteExecutor(Executors.newSingleThreadExecutor()).setEntityCache(new EntityCacheBuilder(model).useReferenceCache(true).useSerializableCache(true).useCacheManager(cacheManager).build()).build();
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = RxSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
Also used : ConfigurationBuilder(io.requery.sql.ConfigurationBuilder) Platform(io.requery.sql.Platform) Configuration(io.requery.sql.Configuration) HSQL(io.requery.sql.platform.HSQL) EntityDataStore(io.requery.sql.EntityDataStore) EntityModel(io.requery.meta.EntityModel) CacheManager(javax.cache.CacheManager) EntityCacheBuilder(io.requery.cache.EntityCacheBuilder) CommonDataSource(javax.sql.CommonDataSource) CachingProvider(javax.cache.spi.CachingProvider) SchemaModifier(io.requery.sql.SchemaModifier) Before(org.junit.Before)

Example 2 with Platform

use of io.requery.sql.Platform in project requery by requery.

the class ReactorTest method setup.

@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;
    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setWriteExecutor(Executors.newSingleThreadExecutor()).setEntityCache(new EntityCacheBuilder(model).useReferenceCache(true).useSerializableCache(true).useCacheManager(cacheManager).build()).build();
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new ReactorEntityStore<>(new EntityDataStore<Persistable>(configuration));
}
Also used : ConfigurationBuilder(io.requery.sql.ConfigurationBuilder) Platform(io.requery.sql.Platform) Configuration(io.requery.sql.Configuration) HSQL(io.requery.sql.platform.HSQL) EntityDataStore(io.requery.sql.EntityDataStore) EntityModel(io.requery.meta.EntityModel) CacheManager(javax.cache.CacheManager) EntityCacheBuilder(io.requery.cache.EntityCacheBuilder) CommonDataSource(javax.sql.CommonDataSource) CachingProvider(javax.cache.spi.CachingProvider) SchemaModifier(io.requery.sql.SchemaModifier) Before(org.junit.Before)

Example 3 with Platform

use of io.requery.sql.Platform in project requery by requery.

the class TimeConversionsTest method setup.

@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.MODEL2;
    Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setEntityCache(new EmptyEntityCache()).setWriteExecutor(Executors.newSingleThreadExecutor()).build();
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new EntityDataStore<>(configuration);
}
Also used : ConfigurationBuilder(io.requery.sql.ConfigurationBuilder) Platform(io.requery.sql.Platform) Configuration(io.requery.sql.Configuration) EmptyEntityCache(io.requery.cache.EmptyEntityCache) HSQL(io.requery.sql.platform.HSQL) EntityModel(io.requery.meta.EntityModel) CommonDataSource(javax.sql.CommonDataSource) SchemaModifier(io.requery.sql.SchemaModifier) Before(org.junit.Before)

Example 4 with Platform

use of io.requery.sql.Platform in project requery by requery.

the class ReactiveTest method setup.

@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;
    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setWriteExecutor(Executors.newSingleThreadExecutor()).setEntityCache(new EntityCacheBuilder(model).useReferenceCache(true).useSerializableCache(true).useCacheManager(cacheManager).build()).build();
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
Also used : ConfigurationBuilder(io.requery.sql.ConfigurationBuilder) Platform(io.requery.sql.Platform) Configuration(io.requery.sql.Configuration) HSQL(io.requery.sql.platform.HSQL) EntityDataStore(io.requery.sql.EntityDataStore) EntityModel(io.requery.meta.EntityModel) CacheManager(javax.cache.CacheManager) EntityCacheBuilder(io.requery.cache.EntityCacheBuilder) CommonDataSource(javax.sql.CommonDataSource) CachingProvider(javax.cache.spi.CachingProvider) SchemaModifier(io.requery.sql.SchemaModifier) Before(org.junit.Before)

Example 5 with Platform

use of io.requery.sql.Platform in project requery by requery.

the class CompletableEntityStoreTest method setup.

@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;
    final TransactionListener transactionListener = new TransactionListener() {

        @Override
        public void beforeBegin(TransactionIsolation isolation) {
        }

        @Override
        public void afterBegin(TransactionIsolation isolation) {
            transactionState = TransactionState.BEGIN;
        }

        @Override
        public void beforeCommit(Set<Type<?>> types) {
        }

        @Override
        public void afterCommit(Set<Type<?>> types) {
            transactionState = TransactionState.COMMIT;
        }

        @Override
        public void beforeRollback(Set<Type<?>> types) {
        }

        @Override
        public void afterRollback(Set<Type<?>> types) {
            transactionState = TransactionState.ROLLBACK;
        }
    };
    Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setStatementCacheSize(10).setBatchUpdateSize(50).setWriteExecutor(Executors.newSingleThreadExecutor()).addTransactionListenerFactory(new Supplier<TransactionListener>() {

        @Override
        public TransactionListener get() {
            return transactionListener;
        }
    }).build();
    data = new CompletableEntityStore<>(new EntityDataStore<Persistable>(configuration));
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
}
Also used : TransactionListener(io.requery.TransactionListener) ConfigurationBuilder(io.requery.sql.ConfigurationBuilder) HashSet(java.util.HashSet) Set(java.util.Set) Platform(io.requery.sql.Platform) Configuration(io.requery.sql.Configuration) HSQL(io.requery.sql.platform.HSQL) TransactionIsolation(io.requery.TransactionIsolation) EntityModel(io.requery.meta.EntityModel) CommonDataSource(javax.sql.CommonDataSource) SchemaModifier(io.requery.sql.SchemaModifier) EntityDataStore(io.requery.sql.EntityDataStore) Supplier(io.requery.util.function.Supplier) Before(org.junit.Before)

Aggregations

Platform (io.requery.sql.Platform)6 EntityModel (io.requery.meta.EntityModel)5 Configuration (io.requery.sql.Configuration)5 ConfigurationBuilder (io.requery.sql.ConfigurationBuilder)5 SchemaModifier (io.requery.sql.SchemaModifier)5 HSQL (io.requery.sql.platform.HSQL)5 CommonDataSource (javax.sql.CommonDataSource)5 Before (org.junit.Before)5 EntityDataStore (io.requery.sql.EntityDataStore)4 EntityCacheBuilder (io.requery.cache.EntityCacheBuilder)3 CacheManager (javax.cache.CacheManager)3 CachingProvider (javax.cache.spi.CachingProvider)3 PersistenceException (io.requery.PersistenceException)1 TransactionIsolation (io.requery.TransactionIsolation)1 TransactionListener (io.requery.TransactionListener)1 EmptyEntityCache (io.requery.cache.EmptyEntityCache)1 Supplier (io.requery.util.function.Supplier)1 SQLException (java.sql.SQLException)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1