This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 4be8d35c31 OAK-11052: AbstractDocumentStore: log when NODES not empty
before/after test (also minor refactoring) (#1663)
4be8d35c31 is described below
commit 4be8d35c315bb02ea1673772bf5c1179bb67263b
Author: Julian Reschke <[email protected]>
AuthorDate: Thu Aug 22 14:18:30 2024 +0200
OAK-11052: AbstractDocumentStore: log when NODES not empty before/after
test (also minor refactoring) (#1663)
---
.../document/AbstractDocumentStoreTest.java | 29 ++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
index 18be742238..2a4e9c2b40 100644
---
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
+++
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
@@ -19,11 +19,13 @@ package org.apache.jackrabbit.oak.plugins.document;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier;
import org.junit.After;
+import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
@@ -56,6 +58,11 @@ public abstract class AbstractDocumentStoreTest {
return new DocumentMK.Builder();
}
+ @Before
+ public void startUp() throws Exception {
+ logNodesPresent(true);
+ }
+
@After
public void cleanUp() throws Exception {
removeTestNodes(org.apache.jackrabbit.oak.plugins.document.Collection.NODES,
removeMe);
@@ -112,7 +119,7 @@ public abstract class AbstractDocumentStoreTest {
}
/**
- * Generate a random string of given size, with or without non-ASCII
characters.
+ * Generate a constant string of given size, with or without non-ASCII
characters.
*/
public static String generateConstantString(int length) {
char[] s = new char[length];
@@ -124,6 +131,7 @@ public abstract class AbstractDocumentStoreTest {
private <T extends Document> void
removeTestNodes(org.apache.jackrabbit.oak.plugins.document.Collection<T> col,
List<String> ids) {
+
if (!ids.isEmpty()) {
long start = System.nanoTime();
try {
@@ -139,10 +147,27 @@ public abstract class AbstractDocumentStoreTest {
}
}
if (ids.size() > 1) {
- long elapsed = (System.nanoTime() - start) / (1000 * 1000);
+ long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()
- start);
float rate = (((float) ids.size()) / (elapsed == 0 ? 1 :
elapsed));
LOG.info(ids.size() + " documents removed in " + elapsed + "ms
(" + rate + "/ms)");
}
}
+
+ logNodesPresent(false);
+ }
+
+ /**
+ * Check for presence of entries in NODE table
+ * @param before
+ */
+ private void logNodesPresent(boolean before) {
+ List<NodeDocument> nodes =
ds.query(org.apache.jackrabbit.oak.plugins.document.Collection.NODES, "\u0000",
"\uFFFF", 10);
+ if (!nodes.isEmpty()) {
+ LOG.info("At least {} document(s) present in '{}' NODES collection
{} test {}: {}", nodes.size(), dsf,
+ before ? "before" : "after",
+
this.getClass().getName().replace("org.apache.jackrabbit.oak.plugins.document.",
"o.a.j.o.o.d.")
+ .replace("org.apache.jackrabbit.oak.", "o.a.j.o."),
+ nodes);
+ }
}
}