use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class LongRunningQueryTest method checkBigResultSet.
/**
*/
private void checkBigResultSet() throws Exception {
ListeningTestLogger testLog = testLog();
LogListener lsnr = LogListener.matches("Query produced big result set").build();
testLog.registerListener(lsnr);
try (FieldsQueryCursor cur = sql("SELECT T0.id FROM test AS T0, test AS T1")) {
Iterator it = cur.iterator();
while (it.hasNext()) it.next();
}
assertTrue(lsnr.check(1_000));
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class LongRunningQueryTest method checkFastQueries.
/**
* Do several fast queries.
* Log messages must not contain info about long query.
*/
private void checkFastQueries() {
ListeningTestLogger testLog = testLog();
LogListener lsnr = LogListener.matches(Pattern.compile(LONG_QUERY_EXEC_MSG)).build();
testLog.registerListener(lsnr);
// Several fast queries.
for (int i = 0; i < 10; ++i) sql("SELECT * FROM test").getAll();
assertFalse(lsnr.check());
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class LongRunningQueryTest method checkLongRunning.
/**
* Do long running query canceled by timeout and check log output.
* Log messages must contain info about long query.
*/
private void checkLongRunning() {
ListeningTestLogger testLog = testLog();
LogListener lsnr = LogListener.matches(LONG_QUERY_EXEC_MSG).build();
testLog.registerListener(lsnr);
sqlCheckLongRunning();
assertTrue(lsnr.check());
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class TcpDiscoverySelfTest method testCheckRingLatency.
/**
* @throws Exception If failed.
*/
@Test
public void testCheckRingLatency() throws Exception {
int hops = 1;
ListeningTestLogger testLog = new ListeningTestLogger(false, log);
// We should discard ring check latency on server node.
LogListener lsnr = LogListener.matches("Latency check has been discarded").times(hops).build();
testLog.registerListener(lsnr);
try {
IgniteEx node = startGrid(getConfiguration("server").setGridLogger(testLog));
startGrid(getConfiguration("client").setClientMode(true));
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi) node.context().discovery().getInjectedDiscoverySpi();
discoverySpi.impl.checkRingLatency(hops);
assertTrue("Check ring latency message wasn't discarded", lsnr.check(1000));
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.
the class ListeningTestLoggerTest method testEchoLogger.
/**
* Check "echo" logger.
*/
@Test
public void testEchoLogger() {
IgniteLogger echo = new StringLogger();
ListeningTestLogger log = new ListeningTestLogger(true, echo);
log.error("1");
log.warning("2");
log.info("3");
log.debug("4");
log.trace("5");
assertEquals("12345", echo.toString());
}
Aggregations