Search in sources :

Example 6 with JdbcStringBasedStoreConfigurationBuilder

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;
}
Also used : JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)

Example 7 with JdbcStringBasedStoreConfigurationBuilder

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();
}
Also used : JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)

Example 8 with JdbcStringBasedStoreConfigurationBuilder

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;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder)

Example 9 with JdbcStringBasedStoreConfigurationBuilder

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");
}
Also used : SimpleConnectionFactory(org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory) DummyInitializationContext(org.infinispan.persistence.DummyInitializationContext) PooledConnectionFactoryConfiguration(org.infinispan.persistence.jdbc.common.configuration.PooledConnectionFactoryConfiguration) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) JdbcStringBasedStoreConfiguration(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfiguration) JdbcStringBasedStoreConfigurationBuilder(org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder) SimpleConnectionFactoryConfiguration(org.infinispan.persistence.jdbc.common.configuration.SimpleConnectionFactoryConfiguration) TestObjectStreamMarshaller(org.infinispan.marshall.TestObjectStreamMarshaller) PooledConnectionFactoryConfiguration(org.infinispan.persistence.jdbc.common.configuration.PooledConnectionFactoryConfiguration) ConnectionFactoryConfiguration(org.infinispan.persistence.jdbc.common.configuration.ConnectionFactoryConfiguration) SimpleConnectionFactoryConfiguration(org.infinispan.persistence.jdbc.common.configuration.SimpleConnectionFactoryConfiguration) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with JdbcStringBasedStoreConfigurationBuilder

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;
}
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