Search in sources :

Example 1 with CacheCheckpointSpi

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;
}
Also used : CacheCheckpointSpi(org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi)

Example 2 with CacheCheckpointSpi

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;
}
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 3 with CacheCheckpointSpi

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);
}
Also used : BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) Marshaller(org.apache.ignite.marshaller.Marshaller) CacheCheckpointSpi(org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi) NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

CacheCheckpointSpi (org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi)3 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)1 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)1 NullLogger (org.apache.ignite.logger.NullLogger)1 Marshaller (org.apache.ignite.marshaller.Marshaller)1 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)1 JdbcCheckpointSpi (org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1 org.hsqldb.jdbc.jdbcDataSource (org.hsqldb.jdbc.jdbcDataSource)1