use of org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi in project ignite by apache.
the class GridCheckpointManagerAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
assert igniteInstanceName != null;
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
if (igniteInstanceName.contains("cache")) {
String cacheName = "test-checkpoints";
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
CacheCheckpointSpi spi = new CacheCheckpointSpi();
spi.setCacheName(cacheName);
cfg.setCacheConfiguration(cacheCfg);
cfg.setCheckpointSpi(spi);
} else if (igniteInstanceName.contains("jdbc")) {
JdbcCheckpointSpi spi = new JdbcCheckpointSpi();
jdbcDataSource ds = new jdbcDataSource();
ds.setDatabase("jdbc:hsqldb:mem:gg_test_" + getClass().getSimpleName());
ds.setUser("sa");
ds.setPassword("");
spi.setDataSource(ds);
spi.setCheckpointTableName("test_checkpoints");
spi.setKeyFieldName("key");
spi.setValueFieldName("value");
spi.setValueFieldType("longvarbinary");
spi.setExpireDateFieldName("expire_date");
cfg.setCheckpointSpi(spi);
}
return cfg;
}
use of org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi in project ignite by apache.
the class GridSessionCheckpointSelfTest method testJdbcCheckpoint.
/**
* @throws Exception If failed.
*/
public void testJdbcCheckpoint() throws Exception {
IgniteConfiguration cfg = getConfiguration();
jdbcDataSource ds = new jdbcDataSource();
ds.setDatabase("jdbc:hsqldb:mem:gg_test");
ds.setUser("sa");
ds.setPassword("");
JdbcCheckpointSpi spi = new JdbcCheckpointSpi();
spi.setDataSource(ds);
spi.setCheckpointTableName("checkpoints");
spi.setKeyFieldName("key");
spi.setValueFieldName("value");
spi.setValueFieldType("longvarbinary");
spi.setExpireDateFieldName("create_date");
GridSessionCheckpointSelfTest.spi = spi;
cfg.setCheckpointSpi(spi);
checkCheckpoints(cfg);
}
Aggregations