Search in sources :

Example 1 with JdbcCheckpointSpi

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;
}
Also used : org.hsqldb.jdbc.jdbcDataSource(org.hsqldb.jdbc.jdbcDataSource) CacheCheckpointSpi(org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) JdbcCheckpointSpi(org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 2 with JdbcCheckpointSpi

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);
}
Also used : org.hsqldb.jdbc.jdbcDataSource(org.hsqldb.jdbc.jdbcDataSource) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) JdbcCheckpointSpi(org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi)

Aggregations

IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 JdbcCheckpointSpi (org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi)2 org.hsqldb.jdbc.jdbcDataSource (org.hsqldb.jdbc.jdbcDataSource)2 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 CacheCheckpointSpi (org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1