use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testServerJoinsMissingClassException.
/**
* @throws Exception If fail.
*/
@Test
public void testServerJoinsMissingClassException() throws Exception {
setExternalLoader = true;
Ignite ignite0 = startGrid(1);
executeContinuousQuery(ignite0.cache(DEFAULT_CACHE_NAME));
ListeningTestLogger listeningLogger = new ListeningTestLogger();
log = listeningLogger;
LogListener lsnr = LogListener.matches(logStr -> logStr.contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling") || logStr.contains("Failed to unmarshal continuous routine handler")).build();
listeningLogger.registerListener(lsnr);
setExternalLoader = false;
GridTestUtils.assertThrows(log, () -> startGrid(2), IgniteCheckedException.class, "Failed to start");
assertTrue(lsnr.check());
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class IgniteUtilsUnitTest method logMessagesCollector.
/**
*/
private ListeningTestLogger logMessagesCollector() {
ListeningTestLogger log = new ListeningTestLogger();
log.registerListener(logMessages::add);
return log;
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class GridCacheFastNodeLeftForTransactionTest method beforeTestsStarted.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
listeningLog = new ListeningTestLogger(false, GridAbstractTest.log);
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class RebuildIndexLogMessageTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
ListeningTestLogger testLog = new ListeningTestLogger(false, super.getConfiguration(igniteInstanceName).getGridLogger());
testLog.registerListener(logLsnr);
testLog.registerListener(latchLsnr);
return super.getConfiguration(igniteInstanceName).setGridLogger(testLog).setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))).setCacheConfiguration(new CacheConfiguration<>().setName(CACHE_NAME_A).setBackups(0).setIndexedTypes(Integer.class, Person.class).setAffinity(new RendezvousAffinityFunction(false, 8)), new CacheConfiguration<>().setName(CACHE_NAME_B).setBackups(0).setIndexedTypes(Integer.class, Person.class).setAffinity(new RendezvousAffinityFunction(false, 8)));
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class RebuildIndexTest method check.
/**
* @throws Exception if failed.
*/
private void check(boolean msgFound) throws Exception {
srvLog = new ListeningTestLogger(false, log);
LogListener idxRebuildLsnr = LogListener.matches(idxRebuildPattert).build();
srvLog.registerListener(idxRebuildLsnr);
IgniteEx node = startGrids(2);
node.cluster().active(true);
IgniteCache<UserKey, UserValue> cache = node.getOrCreateCache(CACHE_NAME);
cache.put(new UserKey(1), new UserValue(333));
cache.put(new UserKey(2), new UserValue(555));
stopGrid(0);
removeIndexBin(0);
node = startGrid(0);
awaitPartitionMapExchange();
forceCheckpoint();
enableCheckpoints(G.allGrids(), false);
// Validate indexes on start.
ValidateIndexesClosure clo = new ValidateIndexesClosure(() -> false, Collections.singleton(CACHE_NAME), 0, 0, false, true);
node.context().resource().injectGeneric(clo);
assertFalse(clo.call().hasIssues());
assertEquals(msgFound, idxRebuildLsnr.check());
}
Aggregations