Search in sources :

Example 1 with AbstractCachePluginProvider

use of org.apache.ignite.plugin.AbstractCachePluginProvider in project ignite by apache.

the class CdcCacheVersionTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setCdcEnabled(true).setWalForceArchiveTimeout(WAL_ARCHIVE_TIMEOUT).setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
    cfg.setPluginProviders(new AbstractTestPluginProvider() {

        @Override
        public String name() {
            return "ConflictResolverProvider";
        }

        @Override
        public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
            if (!ctx.igniteCacheConfiguration().getName().equals(DEFAULT_CACHE_NAME))
                return null;
            return new AbstractCachePluginProvider() {

                @Override
                @Nullable
                public Object createComponent(Class cls) {
                    if (cls != CacheConflictResolutionManager.class || conflictResolutionMgrSupplier == null)
                        return null;
                    return new TestCacheConflictResolutionManager<>();
                }
            };
        }

        @Override
        @Nullable
        public <T> T createComponent(PluginContext ctx, Class<T> cls) {
            if (IgniteWriteAheadLogManager.class.equals(cls))
                return (T) walProvider.apply(((IgniteEx) ctx.grid()).context());
            return null;
        }
    });
    return cfg;
}
Also used : CachePluginContext(org.apache.ignite.plugin.CachePluginContext) PluginContext(org.apache.ignite.plugin.PluginContext) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) CachePluginContext(org.apache.ignite.plugin.CachePluginContext) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) AbstractTestPluginProvider(org.apache.ignite.plugin.AbstractTestPluginProvider) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AbstractCachePluginProvider(org.apache.ignite.plugin.AbstractCachePluginProvider) CachePluginProvider(org.apache.ignite.plugin.CachePluginProvider) IgniteEx(org.apache.ignite.internal.IgniteEx) AbstractCachePluginProvider(org.apache.ignite.plugin.AbstractCachePluginProvider) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 IgniteWriteAheadLogManager (org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager)1 CacheObject (org.apache.ignite.internal.processors.cache.CacheObject)1 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)1 AbstractCachePluginProvider (org.apache.ignite.plugin.AbstractCachePluginProvider)1 AbstractTestPluginProvider (org.apache.ignite.plugin.AbstractTestPluginProvider)1 CachePluginContext (org.apache.ignite.plugin.CachePluginContext)1 CachePluginProvider (org.apache.ignite.plugin.CachePluginProvider)1 PluginContext (org.apache.ignite.plugin.PluginContext)1 Nullable (org.jetbrains.annotations.Nullable)1