Search in sources :

Example 6 with WarmUpConfiguration

use of org.apache.ignite.configuration.WarmUpConfiguration in project ignite by apache.

the class WarmUpSelfTest method testAvailableWarmUpStrategies.

/**
 * Test verifies that available warm-up strategies are correct.
 * <p>
 * Steps:
 * 1)Starting a node, without plugins;
 * 2)Check that only basic strategies are available;
 * 3)Restarting a node with a test plugin containing additional strategies;
 * 4)Checking that basic + from plugin strategies are available.
 *
 * @throws Exception If failed.
 */
@Test
public void testAvailableWarmUpStrategies() throws Exception {
    IgniteEx n = startGrid(getConfiguration(getTestIgniteInstanceName(0)).setPluginProviders());
    GridCacheProcessor cacheProc = n.context().cache();
    Map<Class<? extends WarmUpConfiguration>, WarmUpStrategy> expStrats = Stream.of(new NoOpWarmUpStrategy(), new LoadAllWarmUpStrategy(log, cacheProc::cacheGroups)).collect(toMap(WarmUpStrategy::configClass, identity()));
    Map<Class<? extends WarmUpConfiguration>, WarmUpStrategy> actStrats = CU.warmUpStrategies(n.context());
    assertEquals(expStrats, actStrats);
    stopAllGrids();
    n = startGrid(0);
    WarmUpTestPluginProvider pluginProvider = (WarmUpTestPluginProvider) n.configuration().getPluginProviders()[0];
    pluginProvider.strats.forEach(strat -> assertNull(expStrats.put(strat.configClass(), strat)));
    actStrats = CU.warmUpStrategies(n.context());
    assertEquals(expStrats, actStrats);
}
Also used : WarmUpConfiguration(org.apache.ignite.configuration.WarmUpConfiguration) NoOpWarmUpConfiguration(org.apache.ignite.configuration.NoOpWarmUpConfiguration) IgniteEx(org.apache.ignite.internal.IgniteEx) GridCacheProcessor(org.apache.ignite.internal.processors.cache.GridCacheProcessor) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

WarmUpConfiguration (org.apache.ignite.configuration.WarmUpConfiguration)6 NoOpWarmUpConfiguration (org.apache.ignite.configuration.NoOpWarmUpConfiguration)3 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)3 Test (org.junit.Test)3 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)2 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 WarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 GridCacheProcessor (org.apache.ignite.internal.processors.cache.GridCacheProcessor)1 LoadAllWarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.LoadAllWarmUpStrategy)1 NoOpWarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.NoOpWarmUpStrategy)1 WarmUpStrategySupplier (org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategySupplier)1