use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class CacheStopAndDestroySelfTest method testLocalCloseWithTry.
/**
* Test Local close.
*
* @throws Exception If failed.
*/
public void testLocalCloseWithTry() throws Exception {
memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
String curVal = null;
for (int i = 0; i < 3; i++) {
try (IgniteCache<String, String> cache2 = grid(2).getOrCreateCache(getLocalConfig())) {
IgniteCache<String, String> cache0 = grid(0).cache(CACHE_NAME_LOC);
IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_LOC);
assert cache0.get(KEY_VAL) == null;
assert cache1.get(KEY_VAL) == null;
assert cache2.get(KEY_VAL) == null;
curVal = KEY_VAL + curVal;
cache0.put(KEY_VAL, curVal + 1);
cache1.put(KEY_VAL, curVal + 2);
cache2.put(KEY_VAL, curVal + 3);
assert cache0.get(KEY_VAL).equals(curVal + 1);
assert cache1.get(KEY_VAL).equals(curVal + 2);
assert cache2.get(KEY_VAL).equals(curVal + 3);
}
}
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class CacheStopAndDestroySelfTest method testLocalClose.
/**
* Test Local close.
*
* @throws Exception If failed.
*/
public void testLocalClose() throws Exception {
memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
grid(0).getOrCreateCache(getLocalConfig());
assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 0);
grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 1);
assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 0);
assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 1);
// Local close. Same as Local destroy.
IgniteCache<Object, Object> cache = grid(1).cache(CACHE_NAME_LOC);
cache.close();
checkUsageFails(cache);
assertNull(grid(1).cache(CACHE_NAME_LOC));
// Local creation after closed.
AffinityTopologyVersion topVer = grid(1).context().cache().context().exchange().lastTopologyFuture().get();
IgniteInternalFuture<?> fut = grid(0).context().cache().context().exchange().affinityReadyFuture(topVer);
if (fut != null)
fut.get();
grid(0).getOrCreateCache(getLocalConfig());
grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated0");
grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated1");
grid(2).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated2");
assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated0");
assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated1");
assert grid(2).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated2");
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class AuthenticationConfigurationClusterTest method configuration.
/**
* @param idx Node index.
* @param authEnabled Authentication enabled.
* @param client Client node flag.
* @return Ignite configuration.
* @throws Exception On error.
*/
private IgniteConfiguration configuration(int idx, boolean authEnabled, boolean client) throws Exception {
IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(idx));
cfg.setClientMode(client);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(spi);
cfg.setAuthenticationEnabled(authEnabled);
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
return cfg;
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class AuthenticationProcessorNodeRestartTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (getTestIgniteInstanceIndex(igniteInstanceName) == CLI_NODE)
cfg.setClientMode(true);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(spi);
cfg.setAuthenticationEnabled(true);
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
return cfg;
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class IgnitePdsCheckpointSimpleTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
DataRegionConfiguration regCfg = new DataRegionConfiguration().setPersistenceEnabled(true);
DataStorageConfiguration dsCfg = new DataStorageConfiguration().setPageSize(4 * 1024).setDefaultDataRegionConfiguration(regCfg).setCheckpointFrequency(TimeUnit.SECONDS.toMillis(10));
return cfg.setDataStorageConfiguration(dsCfg);
}
Aggregations