Search in sources :

Example 1 with NoOpWarmUpConfiguration

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

the class WarmUpSelfTest method testNonPersistentDataRegionWarmUpConfiguration.

/**
 * Test checks that an unknown data region warm-up configuration cannot be passed.
 * <p>
 * Steps:
 * 1)Adding an warm-up configuration to non-persistent {@link DataRegionConfiguration};
 * 2)Starting node and getting an error.
 *
 * @throws Exception If failed.
 */
@Test
public void testNonPersistentDataRegionWarmUpConfiguration() throws Exception {
    String regName = "error";
    IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(0)).setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(new DataRegionConfiguration().setName(regName).setWarmUpConfiguration(new NoOpWarmUpConfiguration())));
    assertThrowsAnyCause(log, () -> startGrid(cfg), IgniteCheckedException.class, "Warm-up setting is not expected for a non-persistent data region: [name=" + regName);
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) NoOpWarmUpConfiguration(org.apache.ignite.configuration.NoOpWarmUpConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 2 with NoOpWarmUpConfiguration

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

the class WarmUpSelfTest method testExecutionStrategies.

/**
 * Test checks that strategies are executed according to configuration.
 * <p>
 * Steps:
 * 1)Starting a node with a single region that has been configured for {@link SimpleObservableWarmUpStrategy};
 * 2)Check that strategy was executed only for it region;
 * 3)Restarting node with default {@link SimpleObservableWarmUpConfiguration};
 * 4)Checks that {@link SimpleObservableWarmUpStrategy} was only executed for persistent regions
 * that were not configured by {@link SimpleObservableWarmUpConfiguration}.
 *
 * @throws Exception If failed.
 */
@Test
public void testExecutionStrategies() throws Exception {
    IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(0)).setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(new DataRegionConfiguration().setName("0"), new DataRegionConfiguration().setName("1").setPersistenceEnabled(true), new DataRegionConfiguration().setName("2").setPersistenceEnabled(true).setWarmUpConfiguration(new SimpleObservableWarmUpConfiguration())));
    startGrid(cfg);
    WarmUpTestPluginProvider pluginProvider = (WarmUpTestPluginProvider) cfg.getPluginProviders()[0];
    SimpleObservableWarmUpStrategy observableWarmUp = (SimpleObservableWarmUpStrategy) pluginProvider.strats.get(0);
    assertEquals(1, observableWarmUp.visitRegions.size());
    assertTrue(observableWarmUp.visitRegions.containsKey("2"));
    assertEquals(1, observableWarmUp.visitRegions.get("2").get());
    stopAllGrids();
    cfg = getConfiguration(getTestIgniteInstanceName(0)).setDataStorageConfiguration(new DataStorageConfiguration().setDefaultWarmUpConfiguration(new SimpleObservableWarmUpConfiguration()).setDataRegionConfigurations(new DataRegionConfiguration().setName("0"), new DataRegionConfiguration().setName("1").setPersistenceEnabled(true), new DataRegionConfiguration().setName("2").setPersistenceEnabled(true).setWarmUpConfiguration(new NoOpWarmUpConfiguration())).setDefaultDataRegionConfiguration(new DataRegionConfiguration().setName("3").setPersistenceEnabled(true)));
    startGrid(cfg);
    pluginProvider = (WarmUpTestPluginProvider) cfg.getPluginProviders()[0];
    observableWarmUp = (SimpleObservableWarmUpStrategy) pluginProvider.strats.get(0);
    assertEquals(2, observableWarmUp.visitRegions.size());
    assertTrue(observableWarmUp.visitRegions.containsKey("1"));
    assertTrue(observableWarmUp.visitRegions.containsKey("3"));
    assertEquals(1, observableWarmUp.visitRegions.get("1").get());
    assertEquals(1, observableWarmUp.visitRegions.get("3").get());
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) NoOpWarmUpConfiguration(org.apache.ignite.configuration.NoOpWarmUpConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)2 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 NoOpWarmUpConfiguration (org.apache.ignite.configuration.NoOpWarmUpConfiguration)2 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)2 Test (org.junit.Test)2