use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStoreCompatibilityTest method configurePersistence.
@Override
protected void configurePersistence(ConfigurationBuilder builder, boolean generatingData) {
JdbcStringBasedStoreConfigurationBuilder jdbcB = builder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
jdbcB.segmented(oldSegmented);
jdbcB.table().createOnStart(generatingData).tableNamePrefix("ISPN_STRING_TABLE").idColumnName("ID_COLUMN").idColumnType("VARCHAR(255)").dataColumnName("DATA_COLUMN").dataColumnType("BINARY").timestampColumnName("TIMESTAMP_COLUMN").timestampColumnType("BIGINT").segmented(false);
jdbcB.connectionPool().driverClass(org.h2.Driver.class).connectionUrl(String.format("jdbc:h2:%s;DB_CLOSE_DELAY=0", combinePath(tmpDirectory, "jdbc_db"))).username("sa");
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class TableManagerTest method testConnectionLeakGuessDialect.
public void testConnectionLeakGuessDialect() {
JdbcStringBasedStoreConfigurationBuilder storeBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false).persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
PooledConnectionFactory connectionFactory = new PooledConnectionFactory();
ConnectionFactoryConfiguration config = UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder).create();
connectionFactory.start(config, Thread.currentThread().getContextClassLoader());
// JdbcStringBasedStoreConfiguration defaults to null dialect, so dialect and versions must be guessed
TableManager tableManager = TableManagerFactory.getManager(ctx, connectionFactory, storeBuilder.create(), "GuessDialect");
tableManager.start();
UnitTestDatabaseManager.verifyConnectionLeaks(connectionFactory);
tableManager.stop();
connectionFactory.stop();
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class StringStoreWithManagedConnectionTest method buildConfig.
@Override
protected Configuration buildConfig(ConfigurationBuilder configurationBuilder) {
JdbcStringBasedStoreConfigurationBuilder storeBuilder = configurationBuilder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
storeBuilder.dataSource().jndiUrl(getDatasourceLocation());
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
return configurationBuilder.build();
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class AbstractStringBasedCacheStore method configureCacheManager.
public EmbeddedCacheManager configureCacheManager(boolean passivation, boolean preload, boolean eviction) {
GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder().nonClusteredDefault().defaultCacheName("StringBasedCache");
ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
JdbcStringBasedStoreConfigurationBuilder storeBuilder = builder.persistence().passivation(passivation).addStore(JdbcStringBasedStoreConfigurationBuilder.class).preload(preload);
connectionFactory = getConnectionFactory(storeBuilder);
setTableManipulation(storeBuilder);
if (eviction) {
builder.memory().evictionType(EvictionType.COUNT).size(2);
} else {
builder.memory().evictionType(EvictionType.COUNT).size(-1);
}
tableConfiguration = storeBuilder.create().table();
EmbeddedCacheManager defaultCacheManager = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, builder);
String cacheName = defaultCacheManager.getCache().getName();
PersistenceMarshaller marshaller = defaultCacheManager.getCache().getAdvancedCache().getComponentRegistry().getPersistenceMarshaller();
InitializationContext ctx = new DummyInitializationContext(null, null, marshaller, null, null, null, null, null, null, null);
tableManager = TableManagerFactory.getManager(ctx, connectionFactory, storeBuilder.create(), cacheName);
return defaultCacheManager;
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStringBasedStoreAltMapperTest method createCacheStore.
@BeforeClass
public void createCacheStore() throws PersistenceException {
ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
JdbcStringBasedStoreConfigurationBuilder storeBuilder = createJdbcConfig(builder);
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
JdbcStringBasedStore jdbcStringBasedStore = new JdbcStringBasedStore();
cacheStore = new WaitDelegatingNonBlockingStore(jdbcStringBasedStore, SingleSegmentKeyPartitioner.getInstance());
marshaller = new TestObjectStreamMarshaller(TestDataSCI.INSTANCE);
cacheStore.startAndWait(PersistenceMockUtil.createContext(getClass(), builder.build(), marshaller));
tableManager = jdbcStringBasedStore.getTableManager();
}
Aggregations