use of org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory in project ignite by apache.
the class IgnitePersistentStoreTest method igniteConfig.
/**
*/
private IgniteConfiguration igniteConfig() throws IOException {
URL url = getClass().getClassLoader().getResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-3.xml");
String persistence = U.readFileToString(url.getFile(), "UTF-8");
KeyValuePersistenceSettings persistenceSettings = new KeyValuePersistenceSettings(persistence);
DataSource dataSource = new DataSource();
dataSource.setContactPoints(CassandraHelper.getContactPointsArray());
dataSource.setCredentials(new CassandraAdminCredentials());
dataSource.setLoadBalancingPolicy(new RoundRobinPolicy());
CassandraCacheStoreFactory<String, Person> storeFactory = new CassandraCacheStoreFactory<>();
storeFactory.setDataSource(dataSource);
storeFactory.setPersistenceSettings(persistenceSettings);
CacheConfiguration<String, Person> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setName("cache1");
cacheConfiguration.setReadThrough(true);
cacheConfiguration.setWriteThrough(true);
cacheConfiguration.setCacheStoreFactory(storeFactory);
IgniteConfiguration config = new IgniteConfiguration();
config.setCacheConfiguration(cacheConfiguration);
return config;
}
use of org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory in project ignite by apache.
the class IgnitePersistentStorePrimitiveTest method igniteConfig.
/**
*/
private IgniteConfiguration igniteConfig() throws IOException {
URL url = getClass().getClassLoader().getResource("org/apache/ignite/tests/persistence/blob/persistence-settings-1.xml");
String persistence = U.readFileToString(url.getFile(), "UTF-8");
KeyValuePersistenceSettings persistenceSettings = new KeyValuePersistenceSettings(persistence);
DataSource dataSource = new DataSource();
dataSource.setContactPoints(CassandraHelper.getContactPointsArray());
dataSource.setCredentials(new CassandraAdminCredentials());
dataSource.setLoadBalancingPolicy(new RoundRobinPolicy());
CassandraCacheStoreFactory<Long, Long> storeFactory = new CassandraCacheStoreFactory<>();
storeFactory.setDataSource(dataSource);
storeFactory.setPersistenceSettings(persistenceSettings);
CacheConfiguration<Long, Long> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setName("cache1");
cacheConfiguration.setReadThrough(true);
cacheConfiguration.setWriteThrough(true);
cacheConfiguration.setCacheStoreFactory(storeFactory);
IgniteConfiguration config = new IgniteConfiguration();
config.setCacheConfiguration(cacheConfiguration);
return config;
}
Aggregations