use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class GridPartitionedCacheJtaLookupClassNameSelfTest method testUncompatibleTmLookup.
/**
*
*/
@IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-1094", forceFailure = true)
public void testUncompatibleTmLookup() {
final IgniteEx ignite = grid(0);
final CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setName("Foo");
cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cacheCfg.setTransactionManagerLookupClassName(TestTmLookup2.class.getName());
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws IgniteException {
ignite.createCache(cacheCfg);
return null;
}
}, IgniteException.class, null);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class MemoryPolicyInitializationTest method testCustomConfigNoDefault.
/**
* Verifies that expected memory policies are allocated when used provides MemoryPolicyConfiguration
* with non-default custom MemoryPolicy.
*/
public void testCustomConfigNoDefault() throws Exception {
prepareCustomNoDefaultConfig();
IgniteEx ignite = startGrid(0);
Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
assertTrue(allMemPlcs.size() == 3);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
assertTrue("Custom non-default memory policy is not presented", isMemoryPolicyPresented(allMemPlcs, CUSTOM_NON_DEFAULT_MEM_PLC_NAME));
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class MemoryPolicyInitializationTest method testCustomConfigOverridesDefaultNameAndDeclaresDefault.
/**
* User is allowed to define fully custom memory policy and make it default by setting its name to memory config.
*
* At the same time user still can create a memory policy with name 'default'
* which although won't be used as default.
*/
public void testCustomConfigOverridesDefaultNameAndDeclaresDefault() throws Exception {
prepareCustomConfigWithOverriddenDefaultName();
IgniteEx ignite = startGrid(0);
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
Collection<MemoryPolicy> allMemPlcs = dbMgr.memoryPolicies();
assertTrue(allMemPlcs.size() == 3);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
MemoryPolicy dfltMemPlc = U.field(dbMgr, "dfltMemPlc");
assertTrue(dfltMemPlc.config().getMaxSize() == USER_CUSTOM_MEM_PLC_SIZE);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class MemoryPolicyInitializationTest method testNoConfigProvided.
/**
* Verifies that expected memory policies are allocated when used doesn't provide any MemoryPolicyConfiguration.
*/
public void testNoConfigProvided() throws Exception {
memCfg = null;
IgniteEx ignite = startGrid(0);
Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
assertTrue(allMemPlcs.size() == 2);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class ClusterStateAbstractTest method testDeactivationWithPendingTransaction.
/**
* Tests that state doesn't change until all pending transactions are finished.
*
* @throws Exception If fails.
*/
public void testDeactivationWithPendingTransaction() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-4931");
startGrids(GRID_CNT);
final CountDownLatch finishedLatch = new CountDownLatch(1);
final Ignite ignite0 = grid(0);
final IgniteCache<Object, Object> cache0 = ignite0.cache(CACHE_NAME);
IgniteInternalFuture<?> fut;
try (Transaction tx = ignite0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
cache0.get(1);
fut = multithreadedAsync(new Runnable() {
@Override
public void run() {
ignite0.active(false);
finishedLatch.countDown();
}
}, 1);
U.sleep(2000);
assert !fut.isDone();
boolean hasActive = false;
for (int g = 0; g < GRID_CNT; g++) {
IgniteEx grid = grid(g);
if (grid.active()) {
hasActive = true;
break;
}
}
assertTrue(hasActive);
cache0.put(1, 2);
tx.commit();
}
fut.get(getTestTimeout(), TimeUnit.MILLISECONDS);
checkInactive(GRID_CNT);
ignite0.active(true);
for (int g = 0; g < GRID_CNT; g++) assertEquals(2, grid(g).cache(CACHE_NAME).get(1));
finishedLatch.await();
}
Aggregations