use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testThrottling.
/**
* Tests that thread dumps will be throttled and will be generated again after timeout exceeded.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "3000")
public void testThrottling() throws Exception {
LogListener dumpLsnr = LogListener.matches(THREAD_DUMP_MSG).times(2).build();
LogListener throttledLsnr = LogListener.matches("Thread dump is hidden").times(2).build();
testLog.registerListener(dumpLsnr);
testLog.registerListener(throttledLsnr);
IgniteEx ignite = ignite(0);
FailureContext failureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
U.sleep(3000);
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
assertTrue(dumpLsnr.check());
assertTrue(throttledLsnr.check());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testNoThrottling.
/**
* Tests that thread dumps will get for every failure for disabled throttling.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "0")
public void testNoThrottling() throws Exception {
LogListener lsnr = LogListener.matches(THREAD_DUMP_MSG).times(2).build();
testLog.registerListener(lsnr);
IgniteEx ignite = ignite(0);
FailureContext failureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
assertTrue(lsnr.check());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class GridP2PContinuousDeploymentClientDisconnectTest method testContinuousQueryRemoteTransformer.
/**
* Test starts 1 server node and 1 client node. Class-loading request for the {@link #P2P_TEST_OBJ_RSRC_NAME}
* resource blocks on the client node. The client node tries to deploy CQ with remote transformer for
* the cache {@link #DEFAULT_CACHE_NAME}.
* Expected that exception with 'Failed to unmarshal deployable object.' error message will be thrown and
* the server node wouldn't be failed.
*
* @throws Exception If failed.
*/
@Test
public void testContinuousQueryRemoteTransformer() throws Exception {
Class<Factory<IgniteClosure<CacheEntryEvent<? extends Integer, ? extends Integer>, String>>> rmtTransformerFactoryCls = (Class<Factory<IgniteClosure<CacheEntryEvent<? extends Integer, ? extends Integer>, String>>>) getExternalClassLoader().loadClass(REMOTE_TRANSFORMER_FACTORY_CLS_NAME);
ContinuousQueryWithTransformer<Integer, Integer, String> qry = new ContinuousQueryWithTransformer<Integer, Integer, String>().setLocalListener(evts -> {
// No-op.
}).setRemoteTransformerFactory(rmtTransformerFactoryCls.newInstance());
LogListener lsnr = LogListener.matches("Failed to initialize a continuous query.").build();
testLog.registerListener(lsnr);
IgniteCache<Integer, Integer> cache = grid(1).cache(DEFAULT_CACHE_NAME);
cache.query(qry);
assertTrue(lsnr.check());
// Check that the failure handler was not called.
assertFalse(failure.get());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class GridP2PContinuousDeploymentClientDisconnectTest method testContinuousQueryRemoteFilterFactory.
/**
* Test starts 1 server node and 1 client node. Class-loading request for the {@link #P2P_TEST_OBJ_RSRC_NAME}
* resource blocks on the client node. The client node tries to deploy CQ with remote filter factory for
* the cache {@link #DEFAULT_CACHE_NAME}.
* Expected that exception with 'Failed to initialize a continuous query.' error message will be thrown and
* the server node wouldn't be failed.
*
* @throws Exception If failed.
*/
@Test
public void testContinuousQueryRemoteFilterFactory() throws Exception {
final Class<Factory<? extends CacheEntryEventFilter<Integer, Integer>>> rmtFilterFactoryCls = (Class<Factory<? extends CacheEntryEventFilter<Integer, Integer>>>) getExternalClassLoader().loadClass(REMOTE_FILTER_FACTORY_CLS_NAME);
AbstractContinuousQuery<Integer, Integer> qry = new ContinuousQuery<Integer, Integer>().setLocalListener(evts -> {
// No-op.
}).setRemoteFilterFactory(rmtFilterFactoryCls.newInstance());
IgniteEx client = grid(1);
LogListener lsnr = LogListener.matches("Failed to initialize a continuous query.").build();
testLog.registerListener(lsnr);
IgniteCache<Integer, Integer> cache = client.cache(DEFAULT_CACHE_NAME);
cache.query(qry);
assertTrue(lsnr.check());
// Check that the failure handler was not called.
assertFalse(failure.get());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class P2PUnsupportedClassVersionTest method testScanQuery.
/**
*/
@Test
public void testScanQuery() throws Exception {
IgniteCache<String, String> cache = cli.getOrCreateCache(DEFAULT_CACHE_NAME);
cache.put("3", "3");
LogListener errMsgLsnr = errorMessageListener(PREDICATE_CLASSNAME);
assertThrowsWithCause(() -> {
try {
cache.query(new ScanQuery<>((IgniteBiPredicate<Integer, Integer>) getExternalClassLoader().loadClass(PREDICATE_CLASSNAME).newInstance())).getAll();
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw new IgniteException(e);
}
}, IgniteCheckedException.class);
assertTrue(errMsgLsnr.check());
// Check node is alive.
cache.put("4", "4");
}
Aggregations