You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by da...@apache.org on 2024/12/30 08:16:38 UTC

(jackrabbit-oak) 01/01: OAK-11324 : removed usage of Guava's Sets.symmetricDifference

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

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

commit 09cf30ab3f871f204504fe17b69a3de323707919
Author: Rishabh Kumar <di...@adobe.com>
AuthorDate: Mon Dec 30 13:46:22 2024 +0530

    OAK-11324 : removed usage of Guava's Sets.symmetricDifference
---
 .../oak/plugins/blob/BlobGCCheckpointRefTest.java  |  7 ++-
 .../jackrabbit/oak/plugins/blob/BlobGCTest.java    | 23 ++++----
 .../blob/datastore/BlobIdTrackerStoreTest.java     |  5 +-
 .../oak/commons/collections/CollectionUtils.java   | 20 +++++++
 .../commons/collections/CollectionUtilsTest.java   | 62 ++++++++++++++++++++++
 .../oak/segment/SegmentDataStoreBlobGCIT.java      | 12 ++---
 .../oak/plugins/document/MongoBlobGCTest.java      | 16 +++---
 .../plugins/document/SharedBlobStoreGCTest.java    |  6 +--
 8 files changed, 115 insertions(+), 36 deletions(-)

diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCCheckpointRefTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCCheckpointRefTest.java
index e0f922771d..68e2ec6fff 100644
--- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCCheckpointRefTest.java
+++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCCheckpointRefTest.java
@@ -25,7 +25,6 @@ import java.util.Set;
 
 import javax.management.openmbean.TabularData;
 
-import org.apache.jackrabbit.guava.common.collect.Sets;
 import org.apache.jackrabbit.oak.api.jmx.CheckpointMBean;
 import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -66,7 +65,7 @@ public class BlobGCCheckpointRefTest extends BlobGCTest {
         log.info("{} blobs remaining : {}", present.size(), present);
 
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(maxGcAge), false);
-        assertTrue(Sets.symmetricDifference(present, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(present, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -80,7 +79,7 @@ public class BlobGCCheckpointRefTest extends BlobGCTest {
         long maxGcAge = checkpointMBean.getOldestCheckpointCreationTimestamp() - afterSetupTime;
 
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(maxGcAge), false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -101,7 +100,7 @@ public class BlobGCCheckpointRefTest extends BlobGCTest {
         log.info("Max age configured {}", maxGcAge);
 
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(maxGcAge), false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
     }
 
     /**
diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCTest.java
index 9b2e89767f..8c686519b0 100644
--- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCTest.java
+++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/BlobGCTest.java
@@ -52,7 +52,6 @@ import java.util.concurrent.atomic.AtomicReference;
 
 import ch.qos.logback.classic.Level;
 import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.Sets;
 import org.apache.jackrabbit.guava.common.io.Closer;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -221,7 +220,7 @@ public class BlobGCTest {
         executeGarbageCollection(cluster, cluster.getCollector(0), true);
         Set<String> existingAfterGC = executeGarbageCollection(secondCluster, secondCluster.getCollector(0), false);
 
-        assertTrue(Sets.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
         assertStats(secondCluster.statsProvider, 1, 0, totalAdded.size() - totalPresent.size(),
             totalAdded.size() - totalPresent.size(), secondCluster.blobStoreState.blobsPresent.size(), 
             cluster.blobSize, NAME);
@@ -263,7 +262,7 @@ public class BlobGCTest {
         executeGarbageCollection(cluster, cluster.getCollector(0), true);
         Set<String> existingAfterGC = executeGarbageCollection(secondCluster, secondCluster.getCollector(0), false);
 
-        assertTrue(Sets.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -288,7 +287,7 @@ public class BlobGCTest {
 
         Set<String> existingAfterGC = executeGarbageCollection(secondCluster, secondCluster.getCollector(5, false, true), false);
 
-        assertTrue(Sets.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(totalPresent, existingAfterGC).isEmpty());
         assertStats(secondCluster.statsProvider, 1, 0, totalAdded.size() - totalPresent.size(),
             totalAdded.size() - totalPresent.size(), secondCluster.blobStoreState.blobsPresent.size(),
             secondCluster.blobSize, NAME);
@@ -316,7 +315,7 @@ public class BlobGCTest {
 
         Set<String> existingAfterGC = executeGarbageCollection(secondCluster, secondCluster.getCollector(6, false, true), false);
 
-        assertTrue(Sets.symmetricDifference(totalAdded, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(totalAdded, existingAfterGC).isEmpty());
         assertStats(secondCluster.statsProvider, 1, 1, 0,0, secondCluster.blobStoreState.blobsPresent.size(),
             secondCluster.blobSize, NAME);
     }
@@ -326,7 +325,7 @@ public class BlobGCTest {
         log.info("Starting gc()");
 
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(0), false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
@@ -340,7 +339,7 @@ public class BlobGCTest {
 
         MarkSweepGarbageCollector collector = cluster.getCollector(0, true, false);
         Set<String> existingAfterGC = executeGarbageCollection(cluster, collector, false);
-        assertFalse(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertFalse(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size() + 1,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size() + 1,
@@ -356,7 +355,7 @@ public class BlobGCTest {
 
         setupDirectBinary(1, 0);
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(0), false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
@@ -369,7 +368,7 @@ public class BlobGCTest {
 
         setupDirectBinary(5, 2);
         Set<String> existingAfterGC = executeGarbageCollection(cluster, cluster.getCollector(0), false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
@@ -386,7 +385,7 @@ public class BlobGCTest {
         Set<String> existingAfterGC =
             executeGarbageCollection(cluster, cluster.getCollector(afterSetupTime - cluster.startReferenceTime + 2),
                 false);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsAdded, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsAdded, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0, 0,
             cluster.blobStoreState.blobsAdded.size() - cluster.blobStoreState.blobsPresent.size(),
             cluster.blobStoreState.blobsPresent.size(), cluster.blobSize, NAME);
@@ -553,7 +552,7 @@ public class BlobGCTest {
             cluster.blobStoreState.blobsPresent.size(), cluster.blobSize, NAME);
         assertEquals(deletedSize, getStatCount(cluster.statsProvider, NAME, TOTAL_SIZE_DELETED));
         customLogs.finished();
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -562,7 +561,7 @@ public class BlobGCTest {
 
         Set<String> existingAfterGC =
             executeGarbageCollection(cluster, cluster.getCollector(0),true);
-        assertTrue(Sets.symmetricDifference(cluster.blobStoreState.blobsAdded, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(cluster.blobStoreState.blobsAdded, existingAfterGC).isEmpty());
         assertStats(cluster.statsProvider, 1, 0, 0, 0, cluster.blobStoreState.blobsPresent.size(), cluster.blobSize, 
             NAME);
         assertEquals(cluster.blobStoreState.blobsPresent.size(), getStatCount(cluster.statsProvider, NAME,
diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerStoreTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerStoreTest.java
index 8e7991f1f2..8a54c917ea 100644
--- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerStoreTest.java
+++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerStoreTest.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 
+import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
 import org.apache.jackrabbit.oak.plugins.blob.SharedDataStore;
 import org.apache.jackrabbit.oak.plugins.blob.datastore.BlobIdTracker.BlobIdStore;
 import org.junit.After;
@@ -40,7 +41,6 @@ import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.jackrabbit.guava.common.collect.Sets.symmetricDifference;
 import static java.lang.String.valueOf;
 import static java.util.UUID.randomUUID;
 import static org.apache.commons.io.IOUtils.closeQuietly;
@@ -129,8 +129,7 @@ public class BlobIdTrackerStoreTest {
         Set<String> retrieved = retrieve(store);
 
         assertTrue("Incorrect elements with add before snapshot",
-            symmetricDifference(initAdd, retrieved)
-                .containsAll(Set.of("10001", "10002", "10003")));
+                CollectionUtils.symmetricDifference(initAdd, retrieved).containsAll(Set.of("10001", "10002", "10003")));
     }
 
     @Test
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java
index 82bcbc201d..309ed07797 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java
@@ -33,6 +33,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
@@ -240,6 +241,25 @@ public class CollectionUtils {
         return s1.stream().filter(s2::contains).collect(Collectors.toSet());
     }
 
+    /**
+     * Returns a new set containing the symmetric difference of the two specified sets.
+     * The symmetric difference of two sets is a set containing elements that are in either of the sets,
+     * but not in their intersection.
+     *
+     * @param <T> the type of elements in the sets
+     * @param s1 the first set, must not be null
+     * @param s2 the second set, must not be null
+     * @return a new set containing the symmetric difference of the two specified sets
+     * @throws NullPointerException if either of the sets is null
+     */
+    public static <T> Set<T> symmetricDifference(final Set<T> s1, final Set<T> s2) {
+        Objects.requireNonNull(s1);
+        Objects.requireNonNull(s2);
+        final Set<T> result = new HashSet<>(s1);
+        s2.stream().filter(Predicate.not(result::add)).forEach(result::remove);
+        return result;
+    }
+
     /**
      * Convert an iterable to a {@link java.util.ArrayDeque}.
      * The returning array deque is mutable and supports all optional operations.
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtilsTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtilsTest.java
index 5ae5266b40..13410c73a6 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtilsTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtilsTest.java
@@ -308,6 +308,68 @@ public class CollectionUtilsTest {
         Assert.assertEquals(Collections.EMPTY_SET, CollectionUtils.intersection(set1, set2));
     }
 
+    @Test
+    public void testSymmetricDifferenceWithNonEmptySets() {
+        final Set<String> set1 = Set.of("a", "b", "c");
+        final Set<String> set2 = Set.of("b", "c", "d");
+
+        final Set<String> result = CollectionUtils.symmetricDifference(set1, set2);
+
+        final Set<String> expected = Set.of("a", "d");
+        Assert.assertEquals(expected, result);
+    }
+
+    @Test
+    public void testSymmetricDifferenceWithEmptySet() {
+        final Set<String> set1 = Set.of("a", "b", "c");
+        final Set<String> set2 = new HashSet<>();
+
+        final Set<String> result = CollectionUtils.symmetricDifference(set1, set2);
+
+        final Set<String> expected = Set.of("a", "b", "c");
+        Assert.assertEquals(expected, result);
+    }
+
+    @Test
+    public void testSymmetricDifferenceWithBothEmptySets() {
+        final Set<String> set1 = new HashSet<>();
+        final Set<String> set2 = new HashSet<>();
+
+        final Set<String> result = CollectionUtils.symmetricDifference(set1, set2);
+
+        final Set<String> expected = new HashSet<>();
+        Assert.assertEquals(expected, result);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testSymmetricDifferenceWithNullFirstSet() {
+        final Set<String> set1 = null;
+        final Set<String> set2 = Set.of("a", "b", "c");
+
+        CollectionUtils.symmetricDifference(set1, set2);
+        fail("Shouldn't reach here");
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testSymmetricDifferenceWithNullSecondSet() {
+        Set<String> set1 = Set.of("a", "b", "c");
+        Set<String> set2 = null;
+
+        CollectionUtils.symmetricDifference(set1, set2);
+        fail("Shouldn't reach here");
+    }
+
+    @Test
+    public void testSymmetricDifferenceWithNoCommonElements() {
+        final Set<String> set1 = Set.of("a", "b", "c");
+        final Set<String> set2 = Set.of("d", "e", "f");
+
+        final Set<String> result = CollectionUtils.symmetricDifference(set1, set2);
+
+        final Set<String> expected = Set.of("a", "b", "c", "d", "e", "f");
+        Assert.assertEquals(expected, result);
+    }
+
     @Test
     public void iteratorToIIteratable() {
         Iterator<String> iterator = List.of("a", "b", "c").iterator();
diff --git a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
index b214bac8e8..573133ac90 100644
--- a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
+++ b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentDataStoreBlobGCIT.java
@@ -270,7 +270,7 @@ public class SegmentDataStoreBlobGCIT {
         log.info("{} blobs that should remain after gc : {}", state.blobsPresent.size(), state.blobsPresent);
         log.info("{} blobs for nodes which are deleted : {}", state.blobsPresent.size(), state.blobsPresent);
         Set<String> existingAfterGC = gcInternal(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -299,7 +299,7 @@ public class SegmentDataStoreBlobGCIT {
         log.info("{} blobs that should remain after gc : {}", state.blobsAdded.size(), state.blobsAdded);
         log.info("{} blobs for nodes which are deleted : {}", state.blobsPresent.size(), state.blobsPresent);
         Set<String> existingAfterGC = gcInternal(86400);
-        assertTrue(Sets.symmetricDifference(state.blobsAdded, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsAdded, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -309,7 +309,7 @@ public class SegmentDataStoreBlobGCIT {
         state.blobsAdded.addAll(specialCharNodeBlobs);
         state.blobsPresent.addAll(specialCharNodeBlobs);
         Set<String> existingAfterGC = gcInternal(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -326,7 +326,7 @@ public class SegmentDataStoreBlobGCIT {
     public void consistencyCheckWithGc() throws Exception {
         DataStoreState state = setUp();
         Set<String> existingAfterGC = gcInternal(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
         
         ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
         MarkSweepGarbageCollector gcObj = init(86400, executor);
@@ -372,7 +372,7 @@ public class SegmentDataStoreBlobGCIT {
         log.info("{} Blobs existing after gc {}", existingAfterGC.size(), existingAfterGC);
         
         assertTrue(Sets.difference(state.blobsPresent, existingAfterGC).isEmpty());
-        assertEquals(gc.additionalBlobs, Sets.symmetricDifference(state.blobsPresent, existingAfterGC));
+        assertEquals(gc.additionalBlobs, CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC));
     }
 
     @Test
@@ -383,7 +383,7 @@ public class SegmentDataStoreBlobGCIT {
         log.info("{} blobs that should remain after gc : {}", state.blobsAdded.size(), state.blobsAdded);
         log.info("{} blobs for nodes which are deleted : {}", state.blobsPresent.size(), state.blobsPresent);
         Set<String> existingAfterGC = gcInternal(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
index b5fbbea014..28140ca6a3 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoBlobGCTest.java
@@ -206,7 +206,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
     public void gcDirectMongoDelete() throws Exception {
         DataStoreState state = setUp(true);
         Set<String> existingAfterGC = gc(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
 
@@ -237,7 +237,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
         state.blobsAdded.addAll(specialCharNodeBlobs);
         state.blobsPresent.addAll(specialCharNodeBlobs);
         Set<String> existingAfterGC = gc(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
     
@@ -245,14 +245,14 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
     public void noGc() throws Exception {
         DataStoreState state = setUp(true);
         Set<String> existingAfterGC = gc(86400);
-        assertTrue(Sets.symmetricDifference(state.blobsAdded, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsAdded, existingAfterGC).isEmpty());
     }    
 
     @Test
     public void gcVersionDelete() throws Exception {
         DataStoreState state = setUp(false);
         Set<String> existingAfterGC = gc(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
 
     @Test
@@ -260,7 +260,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
         DataStoreState state = setUp(true);
         addInlined();
         Set<String> existingAfterGC = gc(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
     
     @Test
@@ -268,7 +268,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
         DataStoreState state = setUp(false);
         addInlined();
         Set<String> existingAfterGC = gc(0);
-        assertTrue(Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+        assertTrue(CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
     }
     
     @Test
@@ -299,7 +299,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
         assertTrue("blobsAdded: " + state.blobsAdded +
                         ", blobsPresent: " + state.blobsPresent +
                         ", existingAfterGC: " + existingAfterGC,
-                Sets.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
+                CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC).isEmpty());
         
         ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
         MarkSweepGarbageCollector gcObj = init(86400, executor);
@@ -356,7 +356,7 @@ public class MongoBlobGCTest extends AbstractMongoConnectionTest {
         log.info("{} Blobs existing after gc {}", existingAfterGC.size(), existingAfterGC);
     
         assertTrue(Sets.difference(state.blobsPresent, existingAfterGC).isEmpty());
-        assertEquals(gc.additionalBlobs, Sets.symmetricDifference(state.blobsPresent, existingAfterGC));
+        assertEquals(gc.additionalBlobs, CollectionUtils.symmetricDifference(state.blobsPresent, existingAfterGC));
     }
 
     @Test
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
index 4fe695ef11..48d2938324 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/SharedBlobStoreGCTest.java
@@ -126,7 +126,7 @@ public class SharedBlobStoreGCTest {
         // Execute the gc with sweep
         cluster1.gc.collectGarbage(false);
 
-        assertTrue(Sets.symmetricDifference(
+        assertTrue(CollectionUtils.symmetricDifference(
                 CollectionUtils.union(cluster1.getInitBlobs(), cluster2.getInitBlobs()),
                 cluster1.getExistingBlobIds()).isEmpty());
     }
@@ -143,7 +143,7 @@ public class SharedBlobStoreGCTest {
         // Execute the gc with sweep
         cluster1.gc.collectGarbage(false);
 
-        assertTrue(Sets.symmetricDifference(
+        assertTrue(CollectionUtils.symmetricDifference(
                 CollectionUtils.union(cluster1.getInitBlobs(), cluster2.getInitBlobs()),
                 cluster1.getExistingBlobIds()).isEmpty());
     }
@@ -209,7 +209,7 @@ public class SharedBlobStoreGCTest {
         // Execute the gc with sweep
         cluster2.gc.collectGarbage(false);
 
-        assertTrue(Sets.symmetricDifference(
+        assertTrue(CollectionUtils.symmetricDifference(
             CollectionUtils.union(cluster1.getInitBlobs(), cluster2.getInitBlobs()),
             cluster1.getExistingBlobIds()).isEmpty());
     }