Search in sources :

Example 16 with JdbcStringBasedStoreConfigurationBuilder

use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.

the class JdbcStringBasedStoreMetaTest method createCacheManager.

private void createCacheManager(boolean createOnStart, int segments) {
    ConfigurationBuilder cfg = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
    cfg.clustering().hash().numSegments(segments);
    JdbcStringBasedStoreConfigurationBuilder store = cfg.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class).fetchPersistentState(true);
    store.table().createOnStart(createOnStart);
    UnitTestDatabaseManager.buildTableManipulation(store.table());
    store.simpleConnection().driverClass(org.h2.Driver.class).connectionUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1", JdbcStringBasedStoreMetaTest.class)).username("sa");
    withCacheManager(() -> TestCacheManagerFactory.createCacheManager(cfg), Void -> {
    });
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)

Example 17 with JdbcStringBasedStoreConfigurationBuilder

use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.

the class TxStoreTest method beforeClass.

@BeforeMethod
public void beforeClass() {
    ConfigurationBuilder cc = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    JdbcStringBasedStoreConfigurationBuilder storeBuilder = cc.clustering().cacheMode(CacheMode.DIST_SYNC).persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class).shared(true).transactional(true);
    UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
    UnitTestDatabaseManager.setDialect(storeBuilder);
    UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
    cacheManager = TestCacheManagerFactory.createClusteredCacheManager(cc);
    cache = cacheManager.getCache();
    store = TestingUtil.getFirstStoreWait(cache);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 18 with JdbcStringBasedStoreConfigurationBuilder

use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.

the class JdbcStringParallelIterationTest method configurePersistence.

@Override
protected void configurePersistence(ConfigurationBuilder cb) {
    JdbcStringBasedStoreConfigurationBuilder storeBuilder = cb.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
    UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
    UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
}
Also used : JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)

Aggregations

JdbcStringBasedStoreConfigurationBuilder (org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)18 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)10 TestObjectStreamMarshaller (org.infinispan.marshall.TestObjectStreamMarshaller)2 DummyInitializationContext (org.infinispan.persistence.DummyInitializationContext)2 ConnectionFactoryConfiguration (org.infinispan.persistence.jdbc.common.configuration.ConnectionFactoryConfiguration)2 PooledConnectionFactoryConfiguration (org.infinispan.persistence.jdbc.common.configuration.PooledConnectionFactoryConfiguration)2 SimpleConnectionFactoryConfiguration (org.infinispan.persistence.jdbc.common.configuration.SimpleConnectionFactoryConfiguration)2 JdbcStringBasedStoreConfiguration (org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfiguration)2 BeforeClass (org.testng.annotations.BeforeClass)2 Properties (java.util.Properties)1 CacheConfigurationException (org.infinispan.commons.CacheConfigurationException)1 Configuration (org.infinispan.configuration.cache.Configuration)1 PersistenceConfigurationBuilder (org.infinispan.configuration.cache.PersistenceConfigurationBuilder)1 SingleFileStoreConfigurationBuilder (org.infinispan.configuration.cache.SingleFileStoreConfigurationBuilder)1 StoreConfigurationBuilder (org.infinispan.configuration.cache.StoreConfigurationBuilder)1 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 PersistenceMarshaller (org.infinispan.marshall.persistence.PersistenceMarshaller)1 PooledConnectionFactory (org.infinispan.persistence.jdbc.common.impl.connectionfactory.PooledConnectionFactory)1