use of org.apache.ignite.testframework.LogListener 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.LogListener in project ignite by apache.
the class LongDestroyDurableBackgroundTaskTest method testClusterDeactivationShouldPassWithoutErrors.
/**
* Test case when cluster deactivation happens with no-persistence cache. Index tree deletion task should not be
* started after stopping cache.
*
* @throws Exception If failed.
*/
@Test
public void testClusterDeactivationShouldPassWithoutErrors() throws Exception {
IgniteEx ignite = startGrids(NODES_COUNT);
ignite.cluster().active(true);
IgniteCache<Integer, Integer> cache = ignite.cache("TEST");
query(cache, "create table TEST (id integer primary key, p integer, f integer) with " + "\"DATA_REGION=dr1\"");
query(cache, "create index TEST_IDX on TEST (p)");
for (int i = 0; i < 5_000; i++) query(cache, "insert into TEST (id, p, f) values (?, ?, ?)", i, i, i);
LogListener lsnr = LogListener.matches("Could not execute durable background task").build();
LogListener lsnr2 = LogListener.matches("Executing durable background task").build();
LogListener lsnr3 = LogListener.matches("Execution of durable background task completed").build();
testLog.registerAllListeners(lsnr, lsnr2, lsnr3);
ignite.cluster().active(false);
doSleep(1_000);
assertFalse(lsnr.check());
assertFalse(lsnr2.check());
assertFalse(lsnr3.check());
testLog.unregisterListener(lsnr);
testLog.unregisterListener(lsnr2);
testLog.unregisterListener(lsnr3);
for (int i = 0; i < NODES_COUNT; i++) grid(i);
}
use of org.apache.ignite.testframework.LogListener 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());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class WaitForBackupsOnShutdownSystemPropertyTest method testWaitForBackupsOnShutdownPropertyExists.
/**
* Check the message is printed if IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN is used.
*
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN, value = "false")
public void testWaitForBackupsOnShutdownPropertyExists() throws Exception {
LogListener lnsr = LogListener.matches("IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN system property " + "is deprecated and will be removed in a future version. Use ShutdownPolicy instead.").build();
listeningLog.registerListener(lnsr);
startGrid();
assertTrue("The message was not found", lnsr.check());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class WaitForBackupsOnShutdownSystemPropertyTest method testWaitForBackupsOnShutdownPropertyNotExists.
/**
* Check the message is not printed if IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN is not used.
*
* @throws Exception If failed.
*/
@Test
public void testWaitForBackupsOnShutdownPropertyNotExists() throws Exception {
LogListener lnsr = LogListener.matches("IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN system property " + "is deprecated and will be removed in a future version. Use ShutdownPolicy instead.").build();
listeningLog.registerListener(lnsr);
startGrid();
assertFalse("The message was found", lnsr.check());
}
Aggregations