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 re...@apache.org on 2023/05/16 12:38:52 UTC

[jackrabbit-oak] 01/01: OAK-10247: oak-commons: remove Guava from public API

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

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

commit 5d24063ba546f06e3e55b7cfb5cd5a5fb51a9e7b
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue May 16 13:38:30 2023 +0100

    OAK-10247: oak-commons: remove Guava from public API
---
 oak-commons/pom.xml                                |   9 -
 .../apache/jackrabbit/oak/commons/FileIOUtils.java | 202 ---------------------
 .../jackrabbit/oak/commons/GuavaDeprecation.java   |  87 ---------
 .../jackrabbit/oak/commons/io/LazyInputStream.java |  12 --
 .../jackrabbit/oak/commons/io/package-info.java    |   2 +-
 .../jackrabbit/oak/commons/package-info.java       |   2 +-
 .../jackrabbit/oak/commons/FileIOUtilsTest.java    |  90 ---------
 .../commons/FileLineDifferenceIteratorTest.java    |  43 +----
 .../oak/commons/io/LazyInputStreamTest.java        |  81 ---------
 9 files changed, 10 insertions(+), 518 deletions(-)

diff --git a/oak-commons/pom.xml b/oak-commons/pom.xml
index f58237e68b..a41f22c216 100644
--- a/oak-commons/pom.xml
+++ b/oak-commons/pom.xml
@@ -45,10 +45,6 @@
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
-            <Import-Package>
-              <!-- OAK-7182 -->${guava.osgi.import},
-              *
-            </Import-Package>
             <Export-Package>
               org.apache.jackrabbit.oak.commons,
               org.apache.jackrabbit.oak.commons.cache,
@@ -92,11 +88,6 @@
       <groupId>org.jetbrains</groupId>
       <artifactId>annotations</artifactId>
     </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
index e0143a1994..c13d0c1a8f 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java
@@ -21,7 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.commons.io.FileUtils.forceDelete;
 import static org.apache.commons.io.IOUtils.closeQuietly;
 import static org.apache.commons.io.IOUtils.copyLarge;
-import static org.apache.commons.io.LineIterator.closeQuietly;
 import static org.apache.jackrabbit.guava.common.io.Closeables.close;
 import static org.apache.jackrabbit.guava.common.io.FileWriteMode.APPEND;
 import static org.apache.jackrabbit.guava.common.io.Files.asByteSink;
@@ -34,7 +33,6 @@ import static org.apache.jackrabbit.oak.commons.sort.ExternalSort.sortInBatch;
 
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
-import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -49,14 +47,10 @@ import java.util.Set;
 import java.util.function.Function;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.LineIterator;
 import org.apache.jackrabbit.guava.common.base.Strings;
-import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.PeekingIterator;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Simple File utils
@@ -269,17 +263,6 @@ public final class FileIOUtils {
         return count;
     }
 
-    /**
-     * @deprecated use {@link #writeStrings(Iterator, File, boolean, Function, Logger, String)} instead
-     */
-    @Deprecated(since = "1.20.0", forRemoval = true)
-    public static int writeStrings(Iterator<String> iterator, File f, boolean escape,
-            @NotNull com.google.common.base.Function<String, String> transformer, @Nullable Logger logger, @Nullable String message) throws IOException {
-        GuavaDeprecation.handleCall("OAK-8677");
-        Function<String, String> tr2 = (s) -> transformer.apply(s);
-        return writeStrings(iterator, f, escape, tr2, logger, message);
-    }
-
     /**
      * Reads strings from the given stream into a set and optionally unescaping for line breaks.
      *
@@ -355,22 +338,6 @@ public final class FileIOUtils {
         private Comparator<String> delegate;
         private Function<String, String> func;
 
-        /**
-         * @deprecated use {@link TransformingComparator(Comparator<String>
-         *             delegate, Function<String, String>) instead
-         */
-        @Deprecated(since = "1.50.0", forRemoval = true)
-        public TransformingComparator(Comparator<String> delegate, final com.google.common.base.Function<String, String> func) {
-            GuavaDeprecation.handleCall("OAK-10109");
-            this.delegate = delegate;
-            this.func = new Function<String, String>() {
-                @Override
-                public String apply(String t) {
-                    return func.apply(t);
-                }
-            };
-        }
-
         public TransformingComparator(Comparator<String> delegate, Function<String, String> func) {
             this.delegate = delegate;
             this.func = func;
@@ -381,173 +348,4 @@ public final class FileIOUtils {
             return delegate.compare(func.apply(s1), func.apply(s2));
         }
     }
-
-    /**
-     * FileLineDifferenceIterator class which iterates over the difference of 2 files line by line.
-     *
-     * If there is a scope for lines in the files containing line break characters it should be
-     * ensured that both the files are written with
-     * {@link #writeAsLine(BufferedWriter, String, boolean)} with true to escape line break
-     * characters.
-     * 
-     * @deprecated use {@link org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator} instead
-     */
-    @Deprecated(since = "1.20.0", forRemoval = true)
-    public static class FileLineDifferenceIterator extends com.google.common.collect.AbstractIterator<String> implements Closeable {
-        private final PeekingIterator<String> peekMarked;
-        private final LineIterator marked;
-        private final LineIterator all;
-        private com.google.common.base.Function<String, String> transformer = new com.google.common.base.Function<String, String>() {
-            @Override
-            public String apply(String input) {
-                return input;
-            }
-        };
-
-        public FileLineDifferenceIterator(LineIterator marked, LineIterator available) throws IOException {
-            this(marked, available, null);
-        }
-
-        public FileLineDifferenceIterator(File marked, File available,
-            @Nullable com.google.common.base.Function<String, String> transformer) throws IOException {
-            this(FileUtils.lineIterator(marked, UTF_8.toString()),
-                FileUtils.lineIterator(available, UTF_8.toString()), transformer);
-        }
-
-        public FileLineDifferenceIterator(LineIterator marked, LineIterator available,
-            @Nullable com.google.common.base.Function<String, String> transformer) throws IOException {
-            GuavaDeprecation.handleCall("OAK-8676");
-            this.marked = marked;
-            this.peekMarked = Iterators.peekingIterator(marked);
-            this.all = available;
-            if (transformer != null) {
-                this.transformer = transformer;
-            }
-        }
-
-        @Override
-        protected String computeNext() {
-            String diff = computeNextDiff();
-            if (diff == null) {
-                close();
-                return endOfData();
-            }
-            return diff;
-        }
-
-        @Override
-        public void close() {
-            LineIterator.closeQuietly(marked);
-            LineIterator.closeQuietly(all);
-        }
-
-        private String computeNextDiff() {
-            if (!all.hasNext()) {
-                return null;
-            }
-
-            //Marked finish the rest of all are part of diff
-            if (!peekMarked.hasNext()) {
-                return all.next();
-            }
-
-            String diff = null;
-            while (all.hasNext() && diff == null) {
-                diff = all.next();
-                while (peekMarked.hasNext()) {
-                    String marked = peekMarked.peek();
-                    int comparisonResult = transformer.apply(diff).compareTo(transformer.apply((marked)));
-                    if (comparisonResult > 0) {
-                        //Extra entries in marked. Ignore them and move on
-                        peekMarked.next();
-                    } else if (comparisonResult == 0) {
-                        //Matching entry found in marked move past it. Not a
-                        //dif candidate
-                        peekMarked.next();
-                        diff = null;
-                        break;
-                    } else {
-                        //This entry is not found in marked entries
-                        //hence part of diff
-                        return diff;
-                    }
-                }
-            }
-            return diff;
-        }
-    }
-
-    /**
-     * Implements a {@link java.io.Closeable} wrapper over a {@link LineIterator}.
-     * Also has a transformer to transform the output. If the underlying file is
-     * provide then it deletes the file on {@link #close()}.
-     *
-     * If there is a scope for lines in the file containing line break characters it should be
-     * ensured that the files is written with
-     * {@link #writeAsLine(BufferedWriter, String, boolean)} with true to escape line break
-     * characters and should be properly unescaped on read.
-     * A custom transformer can also be provided to unescape.
-     *
-     * @param <T> the type of elements in the iterator
-     * @deprecated use {@link org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator} instead
-     */
-    @Deprecated(since = "1.20.0", forRemoval = true)
-    public static class BurnOnCloseFileIterator<T> extends com.google.common.collect.AbstractIterator<T> implements Closeable {
-        private final Logger log = LoggerFactory.getLogger(getClass());
-
-        private final LineIterator iterator;
-        private final com.google.common.base.Function<String, T> transformer;
-        private final File backingFile;
-
-        public BurnOnCloseFileIterator(LineIterator iterator, com.google.common.base.Function<String, T> transformer) {
-            this(iterator, null, transformer);
-        }
-
-        public BurnOnCloseFileIterator(LineIterator iterator, File backingFile,
-                com.google.common.base.Function<String, T> transformer) {
-            GuavaDeprecation.handleCall("OAK-8666");
-            this.iterator = iterator;
-            this.transformer = transformer;
-            this.backingFile = backingFile;
-        }
-
-        @Override
-        protected T computeNext() {
-            if (iterator.hasNext()) {
-                return transformer.apply(iterator.next());
-            }
-
-            try {
-                close();
-            } catch (IOException e) {
-                log.warn("Error closing iterator", e);
-            }
-            return endOfData();
-        }
-
-        @Override
-        public void close() throws IOException {
-            closeQuietly(iterator);
-            if (backingFile != null && backingFile.exists()) {
-                forceDelete(backingFile);
-            }
-        }
-
-        public static BurnOnCloseFileIterator<String> wrap(LineIterator iter) {
-            return new BurnOnCloseFileIterator<String>(iter, new com.google.common.base.Function<String, String>() {
-                public String apply(String s) {
-                    return s;
-                }
-            });
-        }
-
-        public static BurnOnCloseFileIterator<String> wrap(LineIterator iter, File backingFile) {
-            return new BurnOnCloseFileIterator<String>(iter, backingFile,
-                new com.google.common.base.Function<String, String>() {
-                    public String apply(String s) {
-                        return s;
-                    }
-                });
-        }
-    }
 }
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java
deleted file mode 100644
index dd648980d9..0000000000
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jackrabbit.oak.commons;
-
-import java.util.Locale;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GuavaDeprecation {
-
-    private static final Logger LOG = LoggerFactory.getLogger(GuavaDeprecation.class);
-
-    private static final String DEFAULT = "error";
-
-    private static final String TLOGLEVEL = System.getProperty(GuavaDeprecation.class + ".LOGLEVEL", DEFAULT);
-
-    private static String LOGLEVEL;
-
-    static {
-        String t;
-
-        switch (TLOGLEVEL.toLowerCase(Locale.ENGLISH)) {
-            case "error":
-            case "warn":
-                t = TLOGLEVEL.toLowerCase(Locale.ENGLISH);
-                break;
-            default:
-                t = DEFAULT;
-                break;
-        }
-
-        LOGLEVEL = t;
-    }
-
-    private GuavaDeprecation() {
-    }
-
-    public static void handleCall(String ticket) throws UnsupportedOperationException {
-        String message = "use of deprecated Guava-related API - this method is going to be removed in future Oak releases - see %s for details";
-
-        switch (LOGLEVEL) {
-            case "error":
-                if (LOG.isErrorEnabled()) {
-                    LOG.error(String.format(message, ticket), new Exception("call stack"));
-                }
-                break;
-            case "warn":
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn(String.format(message, ticket), new Exception("call stack"));
-                }
-                break;
-            case "info":
-                if (LOG.isInfoEnabled()) {
-                    LOG.info(String.format(message, ticket), new Exception("call stack"));
-                }
-                break;
-            case "debug":
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(String.format(message, ticket), new Exception("call stack"));
-                }
-                break;
-        }
-    }
-
-    // for testing
-    public static String setLogLevel(String level) {
-        String before = LOGLEVEL;
-        LOGLEVEL = level;
-        return before;
-    }
-}
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java
index 75a11f7def..a0fb2a28d4 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
 import java.util.function.Supplier;
 
 import org.apache.commons.io.input.ClosedInputStream;
-import org.apache.jackrabbit.oak.commons.GuavaDeprecation;
 
 /**
  * * This input stream delays accessing the {@link InputStream} until the first byte is read
@@ -43,17 +42,6 @@ public class LazyInputStream extends FilterInputStream {
         this.inputStreamSupplier = inputStreamSupplier;
     }
 
-    /**
-     * @deprecated Use {@link #LazyInputStream(Supplier)} instead
-     */
-    @Deprecated(since = "1.20.0", forRemoval = true)
-    public LazyInputStream(com.google.common.io.ByteSource byteSource) {
-        super(null);
-        this.byteSource = byteSource;
-        this.inputStreamSupplier = null;
-        GuavaDeprecation.handleCall("OAK-8661");
-    }
-
     @Override
     public int read() throws IOException {
         ensureOpen();
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java
index 24ad975a13..a0a2ec640b 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-@Version("1.2.0")
+@Version("2.0.0")
 package org.apache.jackrabbit.oak.commons.io;
 
 import org.osgi.annotation.versioning.Version;
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java
index df492d9729..d13032236f 100644
--- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-@Version("1.8.0")
+@Version("2.0.0")
 package org.apache.jackrabbit.oak.commons;
 
 import org.osgi.annotation.versioning.Version;
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java
index 3d4ffbc642..672c6849c2 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java
@@ -63,7 +63,6 @@ import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.guava.common.base.Splitter;
 import org.apache.jackrabbit.guava.common.collect.Sets;
 import org.apache.jackrabbit.guava.common.primitives.Longs;
-import org.apache.jackrabbit.oak.commons.FileIOUtils.BurnOnCloseFileIterator;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Assert;
 import org.junit.Rule;
@@ -108,23 +107,6 @@ public class FileIOUtilsTest {
         assertEquals(actual, retrieved);
     }
 
-    @Test
-    public void writeCustomReadOrgStringsDeprecated() throws Exception {
-        Set<String> added = newHashSet("a-", "z-", "e-", "b-");
-        Set<String> actual = newHashSet("a", "z", "e", "b");
-
-        File f = folder.newFile();
-        int count = writeStrings(added.iterator(), f, false, new com.google.common.base.Function<String, String>() {
-            @Nullable @Override public String apply(@Nullable String input) {
-                return Splitter.on("-").trimResults().omitEmptyStrings().splitToList(input).get(0);
-            }
-        }, null, null);
-        assertEquals(added.size(), count);
-
-        Set<String> retrieved = readStringsAsSet(new FileInputStream(f), false);
-        assertEquals(actual, retrieved);
-    }
-
     @Test
     public void writeReadStringsWithLineBreaks() throws IOException {
         Set<String> added = newHashSet(getLineBreakStrings());
@@ -361,18 +343,6 @@ public class FileIOUtilsTest {
         assertTrue(f.exists());
     }
 
-    @Test
-    public void deprecatedfileIteratorTest() throws Exception {
-        Set<String> added = newHashSet("a", "z", "e", "b");
-        File f = assertWrite(added.iterator(), false, added.size());
-
-        BurnOnCloseFileIterator<String> iterator =
-            BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString()));
-
-        assertEquals(added, Sets.newHashSet(iterator));
-        assertTrue(f.exists());
-    }
-
     @Test
     public void fileIteratorBurnTest() throws Exception {
         Set<String> added = newHashSet("a", "z", "e", "b");
@@ -385,18 +355,6 @@ public class FileIOUtilsTest {
         assertTrue(!f.exists());
     }
 
-    @Test
-    public void deprecatedFileIteratorBurnTest() throws Exception {
-        Set<String> added = newHashSet("a", "z", "e", "b");
-        File f = assertWrite(added.iterator(), false, added.size());
-
-        BurnOnCloseFileIterator<String> iterator =
-            BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString()), f);
-
-        assertEquals(added, Sets.newHashSet(iterator));
-        assertTrue(!f.exists());
-    }
-
     @Test
     public void fileIteratorLineBreakTest() throws IOException {
         Set<String> added = newHashSet(getLineBreakStrings());
@@ -409,18 +367,6 @@ public class FileIOUtilsTest {
         assertTrue(!f.exists());
     }
 
-    @Test
-    public void deprecatedFileIteratorLineBreakTest() throws IOException {
-        Set<String> added = newHashSet(getLineBreakStrings());
-        File f = assertWrite(added.iterator(), true, added.size());
-
-        BurnOnCloseFileIterator<String> iterator = new BurnOnCloseFileIterator<String>(FileUtils.lineIterator(f, UTF_8.toString()),
-                f, (input) -> unescapeLineBreaks(input));
-
-        assertEquals(added, Sets.newHashSet(iterator));
-        assertTrue(!f.exists());
-    }
-
     @Test
     public void fileIteratorRandomizedTest() throws Exception {
         Set<String> added = newHashSet();
@@ -436,21 +382,6 @@ public class FileIOUtilsTest {
         assertTrue(!f.exists());
     }
 
-    @Test
-    public void deprecatedFileIteratorRandomizedTest() throws Exception {
-        Set<String> added = newHashSet();
-        for (int i = 0; i < 100; i++) {
-            added.add(getRandomTestString());
-        }
-        File f = assertWrite(added.iterator(), true, added.size());
-
-        BurnOnCloseFileIterator<String> iterator = new BurnOnCloseFileIterator<String>(FileUtils.lineIterator(f, UTF_8.toString()),
-                f, (input) -> unescapeLineBreaks(input));
-
-        assertEquals(added, Sets.newHashSet(iterator));
-        assertTrue(!f.exists());
-    }
-
     @Test
     public void copyStreamToFile() throws Exception {
         Set<String> added = newHashSet("a", "z", "e", "b");
@@ -477,27 +408,6 @@ public class FileIOUtilsTest {
         assertTrue(!f2.exists());
     }
 
-    @Test
-    public void testDeprecatedTransformingComparator() throws Exception {
-        Comparator<String> delegate = new Comparator<String>() {
-            @Override
-            public int compare(String o1, String o2) {
-                return o1.compareTo(o2);
-            }
-        };
-        com.google.common.base.Function<String, String> fun = new com.google.common.base.Function<String, String>() {
-            @Override
-            public String apply(String input) {
-                return input.toLowerCase(Locale.ENGLISH);
-            }
-        };
-        FileIOUtils.TransformingComparator comp = new FileIOUtils.TransformingComparator(delegate, fun);
-
-        assertTrue(0 > delegate.compare("A", "a"));
-        assertTrue(0 < delegate.compare("a", "A"));
-        assertTrue(0 == comp.compare("a", "A"));
-    }
-
     @Test
     public void testTransformingComparator() throws Exception {
         Comparator<String> delegate = new Comparator<String>() {
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
index f7dc371937..d01716a3de 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java
@@ -19,6 +19,11 @@
 
 package org.apache.jackrabbit.oak.commons;
 
+import static java.util.Arrays.asList;
+import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.escapeLineBreak;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
@@ -29,21 +34,16 @@ import java.util.Random;
 import java.util.TreeSet;
 import java.util.function.Function;
 
+import org.apache.commons.io.LineIterator;
 import org.apache.jackrabbit.guava.common.base.Joiner;
 import org.apache.jackrabbit.guava.common.base.Splitter;
 import org.apache.jackrabbit.guava.common.base.StandardSystemProperty;
 import org.apache.jackrabbit.guava.common.collect.ImmutableList;
 import org.apache.jackrabbit.guava.common.collect.Lists;
-import org.apache.commons.io.LineIterator;
 import org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
-import static java.util.Arrays.asList;
-import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.escapeLineBreak;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
 public class FileLineDifferenceIteratorTest {
     
     @Test
@@ -69,7 +69,7 @@ public class FileLineDifferenceIteratorTest {
                     new ArrayList<String>(diff));
         }
     }
-    
+
     @Test
     public void testNoDiff() throws Exception {
         assertDiff("a,b,c", "a,b,c", Collections.<String> emptyList());
@@ -93,7 +93,7 @@ public class FileLineDifferenceIteratorTest {
         assertDiff("a,b,d,e,f", "a,b,c,f, h", asList("c", "h"));
         assertDiff("3,7", "2,3,5,9", asList("2", "5", "9"));
     }
-    
+
     @Test
     public void testMarkedDiffWithExtraEntriesInMarked() throws IOException {
         assertReverseDiff("a,b,c,e,h", "a,b,c", asList("e", "h"));
@@ -136,18 +136,6 @@ public class FileLineDifferenceIteratorTest {
         assertTransformed("", "a:4, b:1", asList("a:4", "b:1"));
     }
 
-    @Test
-    public void testDiffTransformDeprecated() throws IOException {
-        assertTransformedDeprecated("a:x,b:y", "a:1,b:2,c:3,e:4,h", asList("c:3", "e:4", "h"));
-        assertTransformedDeprecated("a,b,d,e", "a,b,c", asList("c"));
-        assertTransformedDeprecated("a:1,b:2,d:3,e:4,f:5", "a:z,b:y,c:x,f:w", asList("c:x"));
-        assertTransformedDeprecated("a,b,d,e,f", "a,b,c,f,h", asList("c", "h"));
-        assertTransformedDeprecated("3:1,7:6", "2:0,3:6,5:3,9:1", asList("2:0", "5:3", "9:1"));
-        assertTransformedDeprecated("", "", Collections.<String> emptyList());
-        assertTransformedDeprecated("", "a, b", asList("a", "b"));
-        assertTransformedDeprecated("", "a:4, b:1", asList("a:4", "b:1"));
-    }
-
     private static List<String> getLineBreakStrings() {
         return Lists.newArrayList("ab\nc\r", "ab\\z", "a\\\\z\nc",
             "/a", "/a/b\nc", "/a/b\rd", "/a/b\r\ne", "/a/c");
@@ -205,19 +193,4 @@ public class FileLineDifferenceIteratorTest {
 
         assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
     }
-
-    private static void assertTransformedDeprecated(String marked, String all, List<String> diff) throws IOException {
-        Iterator<String> itr = new org.apache.jackrabbit.oak.commons.FileIOUtils.FileLineDifferenceIterator(lineItr(marked), lineItr(all),
-            new com.google.common.base.Function<String, String>() {
-                @Nullable @Override
-                public String apply(@Nullable String input) {
-                    if (input != null) {
-                        return input.split(":")[0];
-                    }
-                    return null;
-                }
-            });
-
-        assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
-    }
 }
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java
index d616650011..ef9475269a 100644
--- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java
@@ -29,16 +29,11 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Locale;
 import java.util.function.Supplier;
 
-import org.apache.jackrabbit.oak.commons.GuavaDeprecation;
-import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.slf4j.event.Level;
 
 /**
  * Tests the LazyInputStream class.
@@ -111,82 +106,6 @@ public class LazyInputStreamTest {
         file.delete();
     }
 
-    @Test
-    public void testDeprecatedLogs() throws IOException {
-        for (Level level : new Level[] { Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR }) {
-            LogCustomizer lc = LogCustomizer.forLogger(GuavaDeprecation.class).enable(level).create();
-            lc.starting();
-            String defaultLevel = GuavaDeprecation.setLogLevel(level.toString().toLowerCase(Locale.ENGLISH));
-            try {
-                testDeprecated();
-                assertEquals(7, lc.getLogs().size());
-            } finally {
-                lc.finished();
-                GuavaDeprecation.setLogLevel(defaultLevel);
-            }
-        }
-    }
-
-    private void testDeprecated() throws IOException {
-        createFile();
-
-        // test open / close (without reading)
-        LazyInputStream in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        in.close();
-
-        // test reading too much and closing too much
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        assertEquals(0, in.read());
-        assertEquals(-1, in.read());
-        assertEquals(-1, in.read());
-        assertEquals(-1, in.read());
-        in.close();
-        in.close();
-        in.close();
-
-        // test markSupported, mark, and reset
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        assertFalse(in.markSupported());
-        in.mark(1);
-        assertEquals(0, in.read());
-        try {
-            in.reset();
-            fail();
-        } catch (IOException e) {
-            // expected
-        }
-        assertEquals(-1, in.read());
-        in.close();
-
-        // test read(byte[])
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        byte[] test = new byte[2];
-        assertEquals(1, in.read(test));
-        in.close();
-
-        // test read(byte[],int,int)
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        assertEquals(1, in.read(test, 0, 2));
-        in.close();
-
-        // test skip
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        assertEquals(2, in.skip(2));
-        assertEquals(-1, in.read(test));
-        in.close();
-
-        createFile();
-
-        // test that the file is closed after reading the last byte
-        in = new LazyInputStream(com.google.common.io.Files.asByteSource(file));
-        assertEquals(0, in.read());
-        assertEquals(-1, in.read());
-
-        in.close();
-
-        file.delete();
-    }
-
     private static Supplier<InputStream> asInputStreamSupplier(final File file) {
         return new Supplier<InputStream> () {
             @Override