use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStringBasedStoreFunctionalTest method createCacheStoreConfig.
@Override
protected PersistenceConfigurationBuilder createCacheStoreConfig(PersistenceConfigurationBuilder persistence, String cacheName, boolean preload) {
JdbcStringBasedStoreConfigurationBuilder store = persistence.addStore(JdbcStringBasedStoreConfigurationBuilder.class).preload(preload);
UnitTestDatabaseManager.buildTableManipulation(store.table());
UnitTestDatabaseManager.configureUniqueConnectionFactory(store);
modifyJdbcConfiguration(store);
return persistence;
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStringBasedStoreTest method buildConfig.
@Override
protected Configuration buildConfig(ConfigurationBuilder configurationBuilder) {
JdbcStringBasedStoreConfigurationBuilder storeBuilder = configurationBuilder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
storeBuilder.segmented(segmented);
UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
return configurationBuilder.build();
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class NonStringKeyPreloadTest method createCacheStoreConfig.
static ConfigurationBuilder createCacheStoreConfig(String mapperName, boolean preload) {
ConfigurationBuilder cfg = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
JdbcStringBasedStoreConfigurationBuilder store = cfg.persistence().connectionAttempts(1).addStore(JdbcStringBasedStoreConfigurationBuilder.class).fetchPersistentState(true).preload(preload).key2StringMapper(mapperName);
UnitTestDatabaseManager.buildTableManipulation(store.table());
UnitTestDatabaseManager.configureUniqueConnectionFactory(store);
return cfg;
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class TableManagerTest method createConnection.
@BeforeClass
public void createConnection() throws Exception {
JdbcStringBasedStoreConfigurationBuilder storeBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false).persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
UnitTestDatabaseManager.setDialect(storeBuilder);
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
ConnectionFactoryConfiguration factoryConfiguration = UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder).create();
if (factoryConfiguration instanceof SimpleConnectionFactoryConfiguration) {
SimpleConnectionFactoryConfiguration simpleConfiguration = (SimpleConnectionFactoryConfiguration) factoryConfiguration;
connectionFactory = ConnectionFactory.getConnectionFactory(SimpleConnectionFactory.class);
connectionFactory.start(simpleConfiguration, connectionFactory.getClass().getClassLoader());
connection = connectionFactory.getConnection();
} else if (factoryConfiguration instanceof PooledConnectionFactoryConfiguration) {
PooledConnectionFactoryConfiguration pooledConfiguration = (PooledConnectionFactoryConfiguration) factoryConfiguration;
connectionFactory = ConnectionFactory.getConnectionFactory(PooledConnectionFactory.class);
connectionFactory.start(pooledConfiguration, connectionFactory.getClass().getClassLoader());
connection = connectionFactory.getConnection();
}
Cache<?, ?> cache = mock(Cache.class);
when(cache.getCacheConfiguration()).thenReturn(new ConfigurationBuilder().build());
JdbcStringBasedStoreConfiguration config = storeBuilder.create();
GlobalConfiguration globalConfiguration = mock(GlobalConfiguration.class);
when(globalConfiguration.classLoader()).thenReturn(getClass().getClassLoader());
ctx = new DummyInitializationContext(config, cache, new TestObjectStreamMarshaller(), null, null, null, globalConfiguration, null, null, null);
tableManager = TableManagerFactory.getManager(ctx, connectionFactory, config, "aName");
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStringBasedClusterTest method addStore.
@Override
protected StoreConfigurationBuilder addStore(PersistenceConfigurationBuilder persistenceConfigurationBuilder, boolean shared) {
JdbcStringBasedStoreConfigurationBuilder storeBuilder = persistenceConfigurationBuilder.addStore(JdbcStringBasedStoreConfigurationBuilder.class);
storeBuilder.shared(shared);
storeBuilder.segmented(segmented);
UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table());
return storeBuilder;
}
Aggregations