From 582caf47962281379a33e8d75ac94779ecf38ebf Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Tue, 17 Sep 2024 10:44:38 +0100 Subject: [PATCH] OAK-11100: remove use of Guava transform/filter - oak-run --- .../mongo/MongoDocumentStoreCheckHelper.java | 14 +++++++------- .../apache/jackrabbit/oak/run/PrintingDiff.java | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStoreCheckHelper.java b/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStoreCheckHelper.java index 4944e72764b..d2839aa0a38 100644 --- a/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStoreCheckHelper.java +++ b/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStoreCheckHelper.java @@ -18,13 +18,14 @@ import com.mongodb.DBObject; +import java.util.stream.Collectors; + +import org.apache.jackrabbit.oak.commons.collections.CollectionUtils; import org.apache.jackrabbit.oak.plugins.document.Collection; import org.apache.jackrabbit.oak.plugins.document.NodeDocument; import org.bson.BsonDocument; import org.bson.BsonInt32; -import static org.apache.jackrabbit.guava.common.collect.Iterables.transform; - /** * MongoDocumentStoreCheckHelper... */ @@ -35,10 +36,9 @@ public static long getEstimatedDocumentCount(MongoDocumentStore store) { } public static Iterable getAllNodeDocuments(MongoDocumentStore store) { - return transform(store.getDBCollection(Collection.NODES) - .find(DBObject.class) - .sort(new BsonDocument("$natural", new BsonInt32(1))), - input -> store.convertFromDBObject(Collection.NODES, input) - ); + return CollectionUtils.toStream( + store.getDBCollection(Collection.NODES).find(DBObject.class).sort(new BsonDocument("$natural", new BsonInt32(1))) + .map(input -> store.convertFromDBObject(Collection.NODES, input))) + .collect(Collectors.toList()); } } diff --git a/oak-run/src/main/java/org/apache/jackrabbit/oak/run/PrintingDiff.java b/oak-run/src/main/java/org/apache/jackrabbit/oak/run/PrintingDiff.java index 1bda8da88e1..e5c46f93360 100644 --- a/oak-run/src/main/java/org/apache/jackrabbit/oak/run/PrintingDiff.java +++ b/oak-run/src/main/java/org/apache/jackrabbit/oak/run/PrintingDiff.java @@ -16,7 +16,6 @@ */ package org.apache.jackrabbit.oak.run; -import static org.apache.jackrabbit.guava.common.collect.Iterables.transform; import static org.apache.commons.io.FileUtils.byteCountToDisplaySize; import static org.apache.jackrabbit.oak.api.Type.BINARIES; import static org.apache.jackrabbit.oak.api.Type.BINARY; @@ -28,9 +27,11 @@ import java.io.PrintWriter; import java.util.function.Function; +import java.util.stream.Collectors; import org.apache.jackrabbit.oak.api.Blob; import org.apache.jackrabbit.oak.api.PropertyState; +import org.apache.jackrabbit.oak.commons.collections.CollectionUtils; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.apache.jackrabbit.oak.spi.state.NodeStateDiff; @@ -126,7 +127,7 @@ private static String toString(PropertyState ps) { String v = BLOB_LENGTH.apply(ps.getValue(BINARY)); val.append(" = {").append(v).append("}"); } else if (ps.getType() == BINARIES) { - String v = transform(ps.getValue(BINARIES), BLOB_LENGTH::apply).toString(); + String v = CollectionUtils.toStream(ps.getValue(BINARIES)).map(BLOB_LENGTH).collect(Collectors.toList()).toString(); val.append("[").append(ps.count()).append("] = ").append(v); } else if (ps.isArray()) { val.append("[").append(ps.count()).append("] = ").append(ps.getValue(STRINGS));