use of org.apache.ignite.internal.processors.cache.warmup.BlockedWarmUpStrategy in project ignite by apache.
the class GridCommandHandlerTest method testSuccessStopWarmUp.
/**
* Verification of successful warm-up stop.
* <p/>
* Steps:
* 1)Starting node with warm-up;
* 2)Stop warm-up;
* 3)Waiting for a successful stop of warm-up and start of node.
*
* @throws Exception If failed.
*/
@Test
public void testSuccessStopWarmUp() throws Exception {
WarmUpTestPluginProvider provider = new WarmUpTestPluginProvider();
IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(0)).setPluginProviders(provider);
cfg.getDataStorageConfiguration().setDefaultWarmUpConfiguration(new BlockedWarmUpConfiguration());
cfg.getConnectorConfiguration().setHost("localhost");
IgniteInternalFuture<IgniteEx> fut = runAsync(() -> startGrid(cfg));
BlockedWarmUpStrategy blockedWarmUpStgy = (BlockedWarmUpStrategy) provider.strats.get(1);
try {
U.await(blockedWarmUpStgy.startLatch, 60, TimeUnit.SECONDS);
// Arguments --user and --password are needed for additional sending of the GridClientAuthenticationRequest.
assertEquals(EXIT_CODE_OK, execute("--warm-up", "--stop", "--yes", "--user", "user", "--password", "123"));
assertEquals(0, blockedWarmUpStgy.stopLatch.getCount());
} finally {
blockedWarmUpStgy.stopLatch.countDown();
fut.get(60_000);
}
}
use of org.apache.ignite.internal.processors.cache.warmup.BlockedWarmUpStrategy in project ignite by apache.
the class JettyRestProcessorBeforeNodeStartSelfTest method testStopWarmUp.
/**
* Test checks that the warm-up will be stopped via an http request.
*
* @throws Exception If failed.
*/
@Test
public void testStopWarmUp() throws Exception {
IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(gridCount()));
cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setWarmUpConfiguration(new BlockedWarmUpConfiguration());
WarmUpTestPluginProvider warmUpProvider = (WarmUpTestPluginProvider) cfg.getPluginProviders()[0];
BlockedWarmUpStrategy warmUpStrat = (BlockedWarmUpStrategy) warmUpProvider.strats.get(1);
nextPort = true;
IgniteInternalFuture<IgniteEx> startNodeFut = GridTestUtils.runAsync(() -> startGrid(cfg));
try {
U.await(warmUpStrat.startLatch, 1, MINUTES);
JsonNode res = content(NODE_STATE_BEFORE_START, null);
assertEquals(STATUS_SUCCESS, res.get("successStatus").intValue());
res = content(WARM_UP, F.asMap("stopWarmUp", "true"));
assertEquals(STATUS_SUCCESS, res.get("successStatus").intValue());
assertEquals(0, warmUpStrat.stopLatch.getCount());
} finally {
warmUpStrat.stopLatch.countDown();
startNodeFut.get(1, MINUTES).close();
}
}
Aggregations