This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch OAK-11688
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 76a4e6a9f79ed3d78fc038df7001de423d3cfa7a
Author: Rishabh Kumar <[email protected]>
AuthorDate: Tue Apr 29 18:01:23 2025 +0530

    OAK-11688 : removed usage of Guava's Iterators.getOnlyElements with 
oak-commons
---
 .../apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java   | 5 ++++-
 .../apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java    | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java
 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java
index 95a8205b8d..261a4269e9 100644
--- 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java
+++ 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/UploadStagingCacheTest.java
@@ -51,6 +51,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.core.data.DataStoreException;
 import org.apache.jackrabbit.oak.commons.FileIOUtils;
 import org.apache.jackrabbit.oak.commons.collections.IteratorUtils;
+import org.apache.jackrabbit.oak.commons.collections.ListUtils;
 import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser;
 import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
 import org.apache.jackrabbit.oak.commons.pio.Closer;
@@ -358,7 +359,9 @@ public class UploadStagingCacheTest extends 
AbstractDataStoreCacheTest {
 
         // Check getAllIdentifiers
         Iterator<String> idsIter = stagingCache.getAllIdentifiers();
-        assertEquals(ID_PREFIX + 0, Iterators.getOnlyElement(idsIter));
+        final List<String> idsList = ListUtils.toList(idsIter);
+        assertEquals(ID_PREFIX + 0, idsList.get(0));
+        assertEquals(1, idsList.size());
 
         //start
         taskLatch.countDown();
diff --git 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
index 4e8de7abf8..4e15960154 100644
--- 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
+++ 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
@@ -32,6 +32,7 @@ import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
+import org.apache.jackrabbit.oak.commons.collections.IteratorUtils;
 import org.apache.jackrabbit.oak.commons.collections.ListUtils;
 import org.apache.jackrabbit.oak.plugins.document.UpdateOp.Key;
 import org.apache.jackrabbit.oak.plugins.document.UpdateOp.Operation;
@@ -104,7 +105,8 @@ public class DocumentSplitTest extends BaseDocumentMKTest {
         // check if document is still there
         assertNotNull(ns.getNode(Path.ROOT, RevisionVector.fromString(head)));
 
-        NodeDocument prevDoc = 
Iterators.getOnlyElement(doc.getAllPreviousDocs());
+        NodeDocument prevDoc = IteratorUtils.get(doc.getAllPreviousDocs(), 0);
+        assertEquals(1, IteratorUtils.size(doc.getAllPreviousDocs()));
         assertThat(prevDoc.getSplitDocType(), 
either(is(SplitDocType.DEFAULT)).or(is(SplitDocType.DEFAULT_NO_BRANCH)));
 
         mk.commit("/", "+\"baz\":{}", null, null);

Reply via email to