use of org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi in project ignite by apache.
the class GridCheckpointTaskSelfTest method checkpointSpi.
/**
* @return Checkpoint SPI.
*/
private CheckpointSpi checkpointSpi() {
CacheCheckpointSpi spi = new CacheCheckpointSpi();
spi.setCacheName(CACHE_NAME);
return spi;
}
use of org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi 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.cache.CacheCheckpointSpi in project ignite by apache.
the class GridSessionCheckpointSelfTest method testCacheCheckpoint.
/**
* @throws Exception If failed.
*/
public void testCacheCheckpoint() throws Exception {
IgniteConfiguration cfg = getConfiguration();
String cacheName = "test-checkpoints";
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
CacheCheckpointSpi spi = new CacheCheckpointSpi();
spi.setCacheName(cacheName);
cfg.setCacheConfiguration(cacheCfg);
cfg.setCheckpointSpi(spi);
if (cfg.getMarshaller() instanceof BinaryMarshaller) {
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
Marshaller marsh = cfg.getMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg);
}
GridSessionCheckpointSelfTest.spi = spi;
checkCheckpoints(cfg);
}
Aggregations