use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class IracJDBCStoreTest method configure.
@Override
protected void configure(ConfigurationBuilder builder) {
JdbcStringBasedStoreConfigurationBuilder jdbcBuilder = builder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
UnitTestDatabaseManager.buildTableManipulation(jdbcBuilder.table());
UnitTestDatabaseManager.configureUniqueConnectionFactory(jdbcBuilder);
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class MigratorConfigurationTest method testDbPropertiesLoaded.
public void testDbPropertiesLoaded() {
Properties properties = createBaseProperties();
properties.putAll(createBaseProperties(TARGET));
Element[] storeTypes = new Element[] { SOURCE, TARGET };
for (Element storeType : storeTypes) {
properties.put(propKey(storeType, DB, MAJOR_VERSION), "1");
properties.put(propKey(storeType, DB, MINOR_VERSION), "1");
properties.put(propKey(storeType, DB, DISABLE_INDEXING), "true");
properties.put(propKey(storeType, DB, DISABLE_UPSERT), "true");
for (Element store : Arrays.asList(STRING, BINARY)) {
properties.put(propKey(storeType, TABLE, store, TABLE_NAME_PREFIX), "mock_table_name");
properties.put(propKey(storeType, TABLE, store, ID, NAME), "mock_id_column_name");
properties.put(propKey(storeType, TABLE, store, ID, TYPE), "mock_id_column_type");
properties.put(propKey(storeType, TABLE, store, DATA, NAME), "mock_data_column_name");
properties.put(propKey(storeType, TABLE, store, DATA, TYPE), "mock_data_column_type");
properties.put(propKey(storeType, TABLE, store, TIMESTAMP, NAME), "mock_timestamp_column_name");
properties.put(propKey(storeType, TABLE, store, TIMESTAMP, TYPE), "mock_timestamp_column_type");
properties.put(propKey(storeType, TABLE, store, SEGMENT, NAME), "mock_segment_column_name");
properties.put(propKey(storeType, TABLE, store, SEGMENT, TYPE), "mock_segment_column_type");
}
}
for (Element storeType : storeTypes) {
StoreProperties props = new StoreProperties(storeType, properties);
JdbcStringBasedStoreConfigurationBuilder builder = new ConfigurationBuilder().persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
Configuration cacheConfig = JdbcConfigurationUtil.configureStore(props, builder).build();
JdbcStringBasedStoreConfiguration config = (JdbcStringBasedStoreConfiguration) cacheConfig.persistence().stores().get(0);
assertEquals((Integer) 1, config.dbMajorVersion());
assertEquals((Integer) 1, config.dbMinorVersion());
assertTrue(Boolean.parseBoolean(config.properties().getProperty(TableManagerFactory.INDEXING_DISABLED)));
assertTrue(Boolean.parseBoolean(config.properties().getProperty(TableManagerFactory.UPSERT_DISABLED)));
}
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class TargetStoreFactory method getInitializedStoreBuilder.
private static StoreConfigurationBuilder getInitializedStoreBuilder(StoreProperties props) {
PersistenceConfigurationBuilder persistenceBuilder = new ConfigurationBuilder().persistence();
StoreType storeType = StoreType.valueOf(props.get(TYPE).toUpperCase());
switch(storeType) {
case LEVELDB:
case JDBC_BINARY:
case JDBC_MIXED:
throw new CacheConfigurationException(String.format("%s cannot be a target store as it no longer exists", storeType));
case JDBC_STRING:
return JdbcConfigurationUtil.configureStore(props, new JdbcStringBasedStoreConfigurationBuilder(persistenceBuilder));
case ROCKSDB:
props.required(LOCATION);
String location = props.get(LOCATION);
RocksDBStoreConfigurationBuilder builder = new RocksDBStoreConfigurationBuilder(persistenceBuilder);
builder.location(location).expiredLocation(location + "-expired-");
String compressionType = props.get(COMPRESSION);
if (compressionType != null)
builder.compressionType(CompressionType.valueOf(compressionType.toUpperCase()));
return builder;
case SINGLE_FILE_STORE:
props.required(LOCATION);
return new SingleFileStoreConfigurationBuilder(persistenceBuilder).location(props.get(LOCATION));
case SOFT_INDEX_FILE_STORE:
props.required(LOCATION);
props.required(INDEX_LOCATION);
return new SoftIndexFileStoreConfigurationBuilder(persistenceBuilder).dataLocation(props.get(LOCATION)).indexLocation(props.get(INDEX_LOCATION));
default:
throw new CacheConfigurationException(String.format("Unknown store type '%s'", storeType));
}
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcConfigurationUtil method getStoreConfig.
static JdbcStringBasedStoreConfiguration getStoreConfig(StoreProperties props) {
JdbcStringBasedStoreConfigurationBuilder builder = new ConfigurationBuilder().persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
configureStore(props, builder);
return builder.create();
}
use of org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder in project infinispan by infinispan.
the class JdbcStoreReader method createBinaryTableConfig.
private JdbcStringBasedStoreConfiguration createBinaryTableConfig() {
if (props.storeType() == StoreType.JDBC_STRING)
return null;
JdbcStringBasedStoreConfigurationBuilder builder = new ConfigurationBuilder().persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
JdbcConfigurationUtil.createTableConfig(props, BINARY, builder);
return builder.create();
}
Aggregations