You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2019/09/16 20:13:50 UTC

[incubator-datasketches-java] 01/01: Use getResourceBytes() and getResourceFile() to allow for spaces in path names.

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

leerho pushed a commit to branch Resources
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git

commit a7f0271d58f299728a88aa49296a2dfab3f0adc2
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Sep 16 13:13:30 2019 -0700

    Use getResourceBytes() and getResourceFile() to allow for spaces in path
    names.
---
 src/main/java/org/apache/datasketches/Util.java    |  57 +++++++++++++++++++
 .../java/org/apache/datasketches/UtilTest.java     |  63 ++++++++++++---------
 .../apache/datasketches/cpc/CpcCBinariesTest.java  |  25 ++++----
 .../datasketches/cpc/SpecialCBinariesTest.java     |   9 ++-
 .../datasketches/kll/KllFloatsSketchTest.java      |   9 ++-
 .../quantiles/ForwardCompatibilityTest.java        |  39 ++++++-------
 .../tuple/ArrayOfDoublesUnionTest.java             |  15 +++--
 .../tuple/CompactSketchWithDoubleSummaryTest.java  |  10 ++--
 .../org/apache/datasketches/tuple/TestUtil.java    |  14 -----
 .../UpdatableSketchWithDoubleSummaryTest.java      |  27 +--------
 ...bleSketchWithDoubleSummary4K_serialVersion1.bin | Bin 69699 -> 0 bytes
 11 files changed, 144 insertions(+), 124 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/Util.java b/src/main/java/org/apache/datasketches/Util.java
index bc9bf66..5ca4c04 100644
--- a/src/main/java/org/apache/datasketches/Util.java
+++ b/src/main/java/org/apache/datasketches/Util.java
@@ -26,6 +26,14 @@ import static java.lang.Math.pow;
 import static java.lang.Math.round;
 import static org.apache.datasketches.hash.MurmurHash3.hash;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
 /**
  * Common utility functions.
  *
@@ -685,4 +693,53 @@ public final class Util {
     return (n1 < n2) ^ ((n1 < 0) != (n2 < 0));
   }
 
+  //Resources
+
+  /**
+   * Gets the absolute path of the given resource file's shortName.
+   *
+   * <p>Note that the ClassLoader.getResource(shortName) returns a URL,
+   * which can have special characters, e.g., "%20" for spaces. This method
+   * obtains the URL, converts it to a URI, then does a uri.getPath(), which
+   * decodes any special characters in the URI path. This is required to make
+   * obtaining resources operating-system independent.</p>
+   *
+   * @param shortFileName the last name in the pathname's name sequence.
+   * @return the absolute path of the given resource file's shortName.
+   */
+  public static String getResourcePath(final String shortFileName) {
+    try {
+      final URL url = Util.class.getClassLoader().getResource(shortFileName);
+      final URI uri = url.toURI();
+      final String path = uri.getPath(); //decodes any special characters
+      return path;
+    } catch (final NullPointerException | URISyntaxException e) {
+      throw new IllegalArgumentException("Cannot find resource: " + shortFileName + LS + e);
+    }
+  }
+
+  /**
+   * Gets the file defined by the given resource file's shortFileName.
+   * @param shortFileName the last name in the pathname's name sequence.
+   * @return the file defined by the given resource file's shortFileName.
+   */
+  public static File getResourceFile(final String shortFileName) {
+    return new File(getResourcePath(shortFileName));
+  }
+
+  /**
+   * Returns a byte array of the contents of the file defined by the given resource file's
+   * shortFileName.
+   * @param shortFileName the last name in the pathname's name sequence.
+   * @return a byte array of the contents of the file defined by the given resource file's
+   * shortFileName.
+   */
+  public static byte[] getResourceBytes(final String shortFileName) {
+    try {
+      return Files.readAllBytes(Paths.get(getResourcePath(shortFileName)));
+    } catch (final IOException e) {
+      throw new IllegalArgumentException("Cannot read resource: " + shortFileName + LS + e);
+    }
+  }
+
 }
diff --git a/src/test/java/org/apache/datasketches/UtilTest.java b/src/test/java/org/apache/datasketches/UtilTest.java
index 7226280..c2257d0 100644
--- a/src/test/java/org/apache/datasketches/UtilTest.java
+++ b/src/test/java/org/apache/datasketches/UtilTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.datasketches;
 
+import static java.lang.Math.pow;
 import static org.apache.datasketches.Util.bytesToInt;
 import static org.apache.datasketches.Util.bytesToLong;
 import static org.apache.datasketches.Util.bytesToString;
@@ -31,6 +32,8 @@ import static org.apache.datasketches.Util.checkProbability;
 import static org.apache.datasketches.Util.evenlyLgSpaced;
 import static org.apache.datasketches.Util.floorPowerOf2;
 import static org.apache.datasketches.Util.floorPowerOfBdouble;
+import static org.apache.datasketches.Util.getResourceBytes;
+import static org.apache.datasketches.Util.getResourceFile;
 import static org.apache.datasketches.Util.intToBytes;
 import static org.apache.datasketches.Util.isLessThanUnsigned;
 import static org.apache.datasketches.Util.isMultipleOf8AndGT0;
@@ -42,9 +45,11 @@ import static org.apache.datasketches.Util.pwr2LawPrev;
 import static org.apache.datasketches.Util.pwrLawNextDouble;
 import static org.apache.datasketches.Util.simpleIntLog2;
 import static org.apache.datasketches.Util.zeroPad;
-import static java.lang.Math.pow;
+import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
+import java.io.File;
+
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -53,6 +58,8 @@ import org.testng.annotations.Test;
  */
 @SuppressWarnings("javadoc")
 public class UtilTest {
+  private static final String LS = System.getProperty("line.separator");
+
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkPowerOf2() {
@@ -170,13 +177,13 @@ public class UtilTest {
     long v = 123456789;
     String vHex = Long.toHexString(v);
     String out = zeroPad(vHex, 16);
-    println(out);
+    println("Pad 16, prepend 0: " + out);
   }
 
   @Test
   public void checkCharacterPad() {
-    String s = "Sleeping ... ";
-    String out = characterPad(s, 20, 'z', true);
+    String s = "Pad 30, postpend z:";
+    String out = characterPad(s, 30, 'z', true);
     println(out);
   }
 
@@ -321,39 +328,41 @@ public class UtilTest {
     } catch (SketchesArgumentException e) {}
   }
 
-  @Test
-  public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
-    print("  Long MAX & MIN: "); print(Long.MAX_VALUE); print(", "); println(Long.MIN_VALUE);
-    print("  Doubles:        "); print(1.2345); print(", "); println(5.4321);
+  //Resources
+
+  @Test(expectedExceptions = IllegalArgumentException.class)
+  void resourcesFileTest() {
+    final String shortFileName = "cpc-empty.bin";
+    final File file = getResourceFile(shortFileName);
+    assertTrue(file.exists());
+    getResourceFile(shortFileName + "123");
   }
 
-  /**
-   * @param s value to print
-   */
-  static void println(String s) {
-    print(s + '\t');
+  @Test(expectedExceptions = IllegalArgumentException.class)
+  void resourcesBytesTest() {
+    final String shortFileName = "cpc-empty.bin";
+    final byte[] bytes = getResourceBytes(shortFileName);
+    assertTrue(bytes.length == 8);
+    getResourceBytes(shortFileName + "123");
   }
 
-  /**
-   * @param d value to print
-   */
-  static void println(double d) {
-    print(Double.toString(d) + '\t');
+  @Test
+  public void printlnTest() {
+    println("PRINTING: "+this.getClass().getName());
   }
 
-  /**
-   * @param d value to print
-   */
-  static void print(double d) {
-    print(Double.toString(d));
+  static void println(final Object o) {
+    if (o == null) { print(LS); }
+    else { print(o.toString() + LS); }
   }
 
   /**
-   * @param s value to print
+   * @param o value to print
    */
-  static void print(String s) {
-    //System.out.print(s); //disable here
+  static void print(final Object o) {
+    if (o != null) {
+      //System.out.print(o.toString()); //disable here
+    }
   }
 
 }
diff --git a/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java b/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
index a3ca6e5..d578609 100644
--- a/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
@@ -19,16 +19,16 @@
 
 package org.apache.datasketches.cpc;
 
+import static org.apache.datasketches.Util.getResourceFile;
 import static org.testng.Assert.assertEquals;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
 
-import org.testng.annotations.Test;
-
 import org.apache.datasketches.memory.MapHandle;
 import org.apache.datasketches.memory.Memory;
+import org.testng.annotations.Test;
 
 /**
  * Checks sketch images obtained from C++.
@@ -42,7 +42,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkEmptyBin() {
     String fileName = "cpc-empty.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory wmem = mh.get();
       println(PreambleUtil.toString(wmem, true));
@@ -56,7 +56,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkSparseBin() {
     String fileName = "cpc-sparse.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U99");
@@ -82,7 +82,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkHybridBin() {
     String fileName = "cpc-hybrid.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U199");
@@ -108,7 +108,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkPinnedBin() {
     String fileName = "cpc-pinned.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U1999");
@@ -134,7 +134,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkSlidingBin() {
     String fileName = "cpc-sliding.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U19999");
@@ -162,7 +162,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkEmptyImages() {
     String fileName = "cpc-empty.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       int cap = (int) mem.getCapacity();
@@ -182,7 +182,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkSparseImages() {
     String fileName = "cpc-sparse.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       int cap = (int) mem.getCapacity();
@@ -203,7 +203,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkHybridImages() {
     String fileName = "cpc-hybrid.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       int cap = (int) mem.getCapacity();
@@ -224,7 +224,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkPinnedImages() {
     String fileName = "cpc-pinned.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       int cap = (int) mem.getCapacity();
@@ -245,7 +245,7 @@ public class CpcCBinariesTest {
   @Test
   public void checkSlidingImages() {
     String fileName = "cpc-sliding.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       int cap = (int) mem.getCapacity();
@@ -304,5 +304,4 @@ public class CpcCBinariesTest {
     //ps.println(s); //disable here
   }
 
-
 }
diff --git a/src/test/java/org/apache/datasketches/cpc/SpecialCBinariesTest.java b/src/test/java/org/apache/datasketches/cpc/SpecialCBinariesTest.java
index 842c7f3..f5c1382 100644
--- a/src/test/java/org/apache/datasketches/cpc/SpecialCBinariesTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/SpecialCBinariesTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.datasketches.cpc;
 
+import static org.apache.datasketches.Util.getResourceFile;
 import static org.testng.Assert.assertTrue;
 
 import java.io.File;
@@ -27,13 +28,12 @@ import java.io.PrintStream;
 import java.nio.ByteOrder;
 import java.nio.file.Files;
 
-import org.testng.annotations.Test;
-
+import org.apache.datasketches.SketchesArgumentException;
 import org.apache.datasketches.memory.MapHandle;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMapHandle;
 import org.apache.datasketches.memory.WritableMemory;
-import org.apache.datasketches.SketchesArgumentException;
+import org.testng.annotations.Test;
 
 /**
  * @author Lee Rhodes
@@ -47,13 +47,12 @@ public class SpecialCBinariesTest {
   @SuppressWarnings("unused")
   public void checkCpc10mBin() {
     String fileName = "cpc-10m.bin";
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
+    File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
       Memory mem = mh.get();
       try {
         CpcSketch sk = CpcSketch.heapify(mem);
       } catch (SketchesArgumentException e) {} // Image was truncated by 4 bytes
-
     } catch (IOException e) {
       e.printStackTrace();
     }
diff --git a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
index 0c3ba2c..bc1c6e5 100644
--- a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
@@ -19,17 +19,16 @@
 
 package org.apache.datasketches.kll;
 
+import static org.apache.datasketches.Util.getResourceBytes;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
-import org.testng.annotations.Test;
-
-import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.SketchesArgumentException;
-import org.apache.datasketches.tuple.TestUtil;
+import org.apache.datasketches.memory.Memory;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class KllFloatsSketchTest {
@@ -353,7 +352,7 @@ public class KllFloatsSketchTest {
 
   @Test
   public void deserializeOneItemV1() throws Exception {
-    byte[] bytes = TestUtil.readBytesFromFile(getClass().getClassLoader().getResource("kll_sketch_float_one_item_v1.bin").getFile());
+    byte[] bytes = getResourceBytes("kll_sketch_float_one_item_v1.bin");
     KllFloatsSketch sketch = KllFloatsSketch.heapify(Memory.wrap(bytes));
     assertFalse(sketch.isEmpty());
     assertFalse(sketch.isEstimationMode());
diff --git a/src/test/java/org/apache/datasketches/quantiles/ForwardCompatibilityTest.java b/src/test/java/org/apache/datasketches/quantiles/ForwardCompatibilityTest.java
index 3085a31..b39882c 100644
--- a/src/test/java/org/apache/datasketches/quantiles/ForwardCompatibilityTest.java
+++ b/src/test/java/org/apache/datasketches/quantiles/ForwardCompatibilityTest.java
@@ -19,17 +19,15 @@
 
 package org.apache.datasketches.quantiles;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
+import static org.apache.datasketches.Util.getResourceBytes;
 
+import org.apache.datasketches.memory.Memory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import org.apache.datasketches.memory.Memory;
-
 @SuppressWarnings("javadoc")
 public class ForwardCompatibilityTest {
+  private static final String LS = System.getProperty("line.separator");
 
   @Test
   //fullPath: sketches/src/test/resources/Qk128_n50_v0.3.0.bin
@@ -111,7 +109,7 @@ public class ForwardCompatibilityTest {
     getAndCheck(ver, n, expected);
   }
 
-  private void getAndCheck(String ver, int n, double quantile) {
+  private static void getAndCheck(String ver, int n, double quantile) {
     DoublesSketch.rand.setSeed(131); //make deterministic
     //create fileName
     int k = 128;
@@ -119,9 +117,8 @@ public class ForwardCompatibilityTest {
     String fileName = String.format("Qk%d_n%d_v%s.bin", k, n, ver);
     println("fullName: "+ fileName);
     println("Old Median: " + quantile);
-    //create & Read File
-    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
-    byte[] byteArr2 = readFile(file);
+    //Read File bytes
+    byte[] byteArr2 = getResourceBytes(fileName);
     Memory srcMem = Memory.wrap(byteArr2);
 
     // heapify as update sketch
@@ -139,27 +136,23 @@ public class ForwardCompatibilityTest {
     Assert.assertEquals(q2, quantile, 0.0);
   }
 
-  private static byte[] readFile(File file) {
-    try ( FileInputStream streamIn = new FileInputStream(file) ) {
-      byte[] byteArr = new byte[(int)file.length()];
-      streamIn.read(byteArr);
-      return byteArr;
-    }
-    catch (NullPointerException | IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
   @Test
   public void printlnTest() {
     println("PRINTING: "+this.getClass().getName());
   }
 
+  static void println(final Object o) {
+    if (o == null) { print(LS); }
+    else { print(o.toString() + LS); }
+  }
+
   /**
-   * @param s value to print
+   * @param o value to print
    */
-  static void println(String s) {
-    //System.out.println(s); //disable here
+  static void print(final Object o) {
+    if (o != null) {
+      //System.out.print(o.toString()); //disable here
+    }
   }
 
 }
diff --git a/src/test/java/org/apache/datasketches/tuple/ArrayOfDoublesUnionTest.java b/src/test/java/org/apache/datasketches/tuple/ArrayOfDoublesUnionTest.java
index 8e93ec7..85e8373 100644
--- a/src/test/java/org/apache/datasketches/tuple/ArrayOfDoublesUnionTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/ArrayOfDoublesUnionTest.java
@@ -19,14 +19,15 @@
 
 package org.apache.datasketches.tuple;
 
-import java.util.Arrays;
+import static org.apache.datasketches.Util.getResourceBytes;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import java.util.Arrays;
 
+import org.apache.datasketches.SketchesArgumentException;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMemory;
-import org.apache.datasketches.SketchesArgumentException;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class ArrayOfDoublesUnionTest {
@@ -203,15 +204,13 @@ public class ArrayOfDoublesUnionTest {
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void noSupportHeapifyV0_9_1() throws Exception {
-    final byte[] bytes = TestUtil.readBytesFromFile(
-        getClass().getClassLoader().getResource("ArrayOfDoublesUnion_v0.9.1.bin").getFile());
+    final byte[] bytes = getResourceBytes("ArrayOfDoublesUnion_v0.9.1.bin");
     ArrayOfDoublesUnion.heapify(Memory.wrap(bytes));
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void noSupportWrapV0_9_1() throws Exception {
-    final byte[] bytes = TestUtil.readBytesFromFile(
-        getClass().getClassLoader().getResource("ArrayOfDoublesUnion_v0.9.1.bin").getFile());
+    final byte[] bytes = getResourceBytes("ArrayOfDoublesUnion_v0.9.1.bin");
     ArrayOfDoublesUnion.wrap(WritableMemory.wrap(bytes));
   }
 
diff --git a/src/test/java/org/apache/datasketches/tuple/CompactSketchWithDoubleSummaryTest.java b/src/test/java/org/apache/datasketches/tuple/CompactSketchWithDoubleSummaryTest.java
index 4d75c19..547986d 100644
--- a/src/test/java/org/apache/datasketches/tuple/CompactSketchWithDoubleSummaryTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/CompactSketchWithDoubleSummaryTest.java
@@ -19,14 +19,15 @@
 
 package org.apache.datasketches.tuple;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import static org.apache.datasketches.Util.getResourceBytes;
 
-import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.SketchesArgumentException;
+import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.tuple.adouble.DoubleSummary;
 import org.apache.datasketches.tuple.adouble.DoubleSummaryDeserializer;
 import org.apache.datasketches.tuple.adouble.DoubleSummaryFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class CompactSketchWithDoubleSummaryTest {
@@ -175,8 +176,7 @@ public class CompactSketchWithDoubleSummaryTest {
 
   @Test
   public void serialVersion1Compatibility() throws Exception {
-    byte[] bytes = TestUtil.readBytesFromFile(getClass().getClassLoader()
-        .getResource("CompactSketchWithDoubleSummary4K_serialVersion1.bin").getFile());
+    byte[] bytes = getResourceBytes("CompactSketchWithDoubleSummary4K_serialVersion1.bin");
     Sketch<DoubleSummary> sketch = Sketches.heapifySketch(Memory.wrap(bytes), new DoubleSummaryDeserializer());
     Assert.assertTrue(sketch.isEstimationMode());
     Assert.assertEquals(sketch.getEstimate(), 8192, 8192 * 0.99);
diff --git a/src/test/java/org/apache/datasketches/tuple/TestUtil.java b/src/test/java/org/apache/datasketches/tuple/TestUtil.java
index bc50092..2c33785 100644
--- a/src/test/java/org/apache/datasketches/tuple/TestUtil.java
+++ b/src/test/java/org/apache/datasketches/tuple/TestUtil.java
@@ -19,9 +19,7 @@
 
 package org.apache.datasketches.tuple;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -59,16 +57,4 @@ public class TestUtil {
     }
   }
 
-  public static byte[] readBytesFromFile(String fileName) throws IOException {
-    try (FileInputStream in = new FileInputStream(new File(fileName))) {
-      ByteArrayOutputStream out = new ByteArrayOutputStream();
-      byte[] bytes = new byte[1024];
-      int len;
-      while ((len = in.read(bytes, 0, bytes.length)) != -1) {
-        out.write(bytes, 0, len);
-      }
-      return out.toByteArray();
-    }
-  }
-
 }
diff --git a/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java b/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java
index 07679c9..ea18d4f 100644
--- a/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java
@@ -19,12 +19,9 @@
 
 package org.apache.datasketches.tuple.adouble;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.ResizeFactor;
 import org.apache.datasketches.SketchesArgumentException;
+import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.tuple.AnotB;
 import org.apache.datasketches.tuple.CompactSketch;
 import org.apache.datasketches.tuple.Intersection;
@@ -35,6 +32,8 @@ import org.apache.datasketches.tuple.Union;
 import org.apache.datasketches.tuple.UpdatableSketch;
 import org.apache.datasketches.tuple.UpdatableSketchBuilder;
 import org.apache.datasketches.tuple.adouble.DoubleSummary.Mode;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class UpdatableSketchWithDoubleSummaryTest {
@@ -836,24 +835,4 @@ public class UpdatableSketchWithDoubleSummaryTest {
       (new DoubleSummaryFactory()).setSamplingProbability(2f).build();
   }
 
-//@Test
-//  @Deprecated
-//  public void serialVersion1Compatibility() throws Exception {
-//    byte[] bytes = TestUtil.readBytesFromFile(getClass().getClassLoader()
-//        .getResource("UpdatableSketchWithDoubleSummary4K_serialVersion1.bin").getFile());
-//    UpdatableSketch<Double, DoubleSummary> sketch =
-//        Sketches.heapifyUpdatableSketch(
-//            Memory.wrap(bytes), new DoubleSummaryDeserializer(), new DoubleSummaryFactory());
-//    Assert.assertTrue(sketch.isEstimationMode());
-//    Assert.assertEquals(sketch.getEstimate(), 8192, 8192 * 0.99);
-//    Assert.assertEquals(sketch.getRetainedEntries(), 4096);
-//    int count = 0;
-//    SketchIterator<DoubleSummary> it = sketch.iterator();
-//    while (it.next()) {
-//      Assert.assertEquals(it.getSummary().getValue(), 10.0);
-//      count++;
-//    }
-//    Assert.assertEquals(count, 4096);
-//  }
-
 }
diff --git a/src/test/resources/UpdatableSketchWithDoubleSummary4K_serialVersion1.bin b/src/test/resources/UpdatableSketchWithDoubleSummary4K_serialVersion1.bin
deleted file mode 100644
index b3f989d..0000000
Binary files a/src/test/resources/UpdatableSketchWithDoubleSummary4K_serialVersion1.bin and /dev/null differ


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org