mbaedke commented on code in PR #1780:
URL: https://github.com/apache/jackrabbit-oak/pull/1780#discussion_r1796911513
##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBConnectionHandlerTest.java:
##########
@@ -30,25 +31,29 @@ public class RDBConnectionHandlerTest {
@Test
public void logging() throws Exception {
- LogCustomizer customLogs =
LogCustomizer.forLogger(RDBConnectionHandler.class.getName()).enable(Level.TRACE)
+ LogCustomizer customLogs =
LogCustomizer.forLogger(RDBConnectionHandler.class).enable(Level.TRACE)
.contains("while obtaining new").create();
DataSource ds = RDBDataSourceFactory.forJdbcUrl("jdbc:h2:mem:", "",
"");
Connection c1 = null, c2 = null, c3 = null;
try (RDBConnectionHandler ch = new RDBConnectionHandler(ds)) {
+ // warmup
+ ch.getROConnection().close();
+ // test
customLogs.starting();
+ long ts1 = System.currentTimeMillis();
c1 = ch.getROConnection();
- long ts = System.currentTimeMillis();
- assertEquals(0, customLogs.getLogs().size());
+ assertTrue("There should be no log message yet, but got: " +
customLogs.getLogs(), customLogs.getLogs().isEmpty());
+ long ts2 = System.currentTimeMillis();
+ assertTrue("unexpected elapsed time between two fetches of
connections: " + (ts2 - ts1), ts2 - ts1 <= 20);
c2 = ch.getROConnection();
// age threshold not reached
- assertEquals(0, customLogs.getLogs().size());
- while (System.currentTimeMillis() - ts < 21) {
- // busy wait for LOGTHRESHOLD to pass
+ assertTrue("There should be no log message get, but got: " +
customLogs.getLogs(), customLogs.getLogs().isEmpty());
Review Comment:
s/get/yet
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]