use of org.apache.ignite.failure.FailureContext in project ignite by apache.
the class DistributedProcessCoordinatorLeftTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setLocalEventListeners(Collections.singletonMap(event -> {
nodeLeftLatch.countDown();
try {
msgSendLatch.await();
} catch (InterruptedException e) {
fail("Unexpected interrupt.");
}
return false;
}, new int[] { EVT_NODE_LEFT, EVT_NODE_FAILED }));
cfg.setFailureHandler(new FailureHandler() {
@Override
public boolean onFailure(Ignite ignite, FailureContext failureCtx) {
failure.set(true);
return false;
}
});
return cfg;
}
use of org.apache.ignite.failure.FailureContext in project ignite by apache.
the class IgniteCacheContinuousQueryClientTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setFailureHandler(new AbstractFailureHandler() {
@Override
protected boolean handle(Ignite ignite, FailureContext failureCtx) {
failure.set(true);
return true;
}
});
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(atomicityMode());
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
use of org.apache.ignite.failure.FailureContext in project ignite by apache.
the class ServiceAuthorizationTest method configuration.
/**
* @return Ignite node configuration.
*/
private IgniteConfiguration configuration(int idx, SecurityPermission... perms) throws Exception {
String name = getTestIgniteInstanceName(idx);
IgniteConfiguration cfg = getConfiguration(name, new TestSecurityPluginProvider(name, "", create().defaultAllowAll(false).appendSystemPermissions(JOIN_AS_SERVER).appendCachePermissions(DEFAULT_CACHE_NAME, CACHE_CREATE).appendTaskPermissions("org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob", TASK_EXECUTE, TASK_CANCEL).appendServicePermissions(TEST_SERVICE_NAME, perms).build(), null, false)).setClientMode(isClient);
if (authErrLatch != null) {
cfg.setFailureHandler(new FailureHandler() {
@Override
public boolean onFailure(Ignite ignite, FailureContext failureCtx) {
assertTrue(failureCtx.error() instanceof SecurityException);
assertTrue(failureCtx.error().getMessage().startsWith("Authorization failed [perm=SERVICE_DEPLOY, name=test-service-name"));
authErrLatch.countDown();
return true;
}
});
}
return cfg;
}
use of org.apache.ignite.failure.FailureContext in project ignite by apache.
the class GridP2PContinuousDeploymentClientDisconnectTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(defaultCacheConfiguration());
cfg.setGridLogger(testLog);
cfg.setFailureHandler(new AbstractFailureHandler() {
/**
* {@inheritDoc}
*/
@Override
protected boolean handle(Ignite ignite, FailureContext failureCtx) {
failure.set(true);
return false;
}
});
return cfg;
}
Aggregations