changeset 10769:bddf51e3686f

8193131: Need to remove SharedBuffer unit Test cases Reviewed-by: arajkumar, rkamath
author mbilla
date Mon, 08 Jan 2018 12:55:16 +0530
parents 36182d670b61
children 4d7bd58ad518
files modules/javafx.web/src/test/java/test/com/sun/webkit/SharedBufferTest.java modules/javafx.web/src/test/java/test/com/sun/webkit/SimpleSharedBufferInputStreamTest.java
diffstat 2 files changed, 2 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.web/src/test/java/test/com/sun/webkit/SharedBufferTest.java	Wed Jan 03 15:30:19 2018 +0530
+++ b/modules/javafx.web/src/test/java/test/com/sun/webkit/SharedBufferTest.java	Mon Jan 08 12:55:16 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 import java.util.Random;
 import org.junit.After;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -124,14 +123,6 @@
                 getSomeData(SEGMENT_SIZE - 10, 10));
     }
 
-    @Test @Ignore
-    public void testGetSomeDataFirstSegmentLastTenBytesWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE - 5, 5),
-                getSomeData(SEGMENT_SIZE - 5, 10));
-    }
-
     @Test
     public void testGetSomeDataInteriorSegmentFirstTenBytes() {
         append(SEGMENT_SIZE * 2.5);
@@ -154,14 +145,6 @@
                 getSomeData(SEGMENT_SIZE * 2 - 10, 10));
     }
 
-    @Test @Ignore
-    public void testGetSomeDataInteriorSegmentLastTenBytesWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE * 2 - 5, 5),
-                getSomeData(SEGMENT_SIZE * 2 - 5, 10));
-    }
-
     @Test
     public void testGetSomeDataLastSegmentFirstTenBytes() {
         append(SEGMENT_SIZE * 2.5);
@@ -211,14 +194,6 @@
         assertArrayEquals(g(0, SEGMENT_SIZE), getSomeData(0, SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testGetSomeDataFirstSegmentWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE * 0.5, SEGMENT_SIZE - SEGMENT_SIZE * 0.5),
-                getSomeData(SEGMENT_SIZE * 0.5, SEGMENT_SIZE));
-    }
-
     @Test
     public void testGetSomeDataInteriorSegment() {
         append(SEGMENT_SIZE * 2.5);
@@ -227,14 +202,6 @@
                 getSomeData(SEGMENT_SIZE, SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testGetSomeDataInteriorSegmentWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE * 1.5, SEGMENT_SIZE - SEGMENT_SIZE * 0.5),
-                getSomeData(SEGMENT_SIZE * 1.5, SEGMENT_SIZE));
-    }
-
     @Test
     public void testGetSomeDataLastSegment() {
         append(SEGMENT_SIZE * 2.5);
@@ -389,41 +356,6 @@
         assertSharedBufferContains(g(0, SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testAppendThreeSegments() {
-        append(g(0, SEGMENT_SIZE * 3));
-        assertSharedBufferContains(
-                g(0, SEGMENT_SIZE),
-                g(SEGMENT_SIZE, SEGMENT_SIZE),
-                g(SEGMENT_SIZE * 2, SEGMENT_SIZE));
-    }
-
-    @Test @Ignore
-    public void testAppendThreeSegmentsPlusSegmentPlusTenBytes() {
-        append(g(0, SEGMENT_SIZE * 3));
-        append(g(0, SEGMENT_SIZE));
-        append(g(0, 10));
-        assertSharedBufferContains(
-                g(0, SEGMENT_SIZE),
-                g(SEGMENT_SIZE, SEGMENT_SIZE),
-                g(SEGMENT_SIZE * 2, SEGMENT_SIZE),
-                g(0, SEGMENT_SIZE),
-                g(0, 10));
-    }
-
-    @Test @Ignore
-    public void testAppendTenBytesPlusSegmentPlusThreeSegments() {
-        append(g(0, 10));
-        append(g(0, SEGMENT_SIZE));
-        append(g(0, SEGMENT_SIZE * 3));
-        assertSharedBufferContains(
-                g(0, 10),
-                g(0, SEGMENT_SIZE),
-                g(0, SEGMENT_SIZE),
-                g(SEGMENT_SIZE, SEGMENT_SIZE),
-                g(SEGMENT_SIZE * 2, SEGMENT_SIZE));
-    }
-
     @Test
     public void testAppendZeroBytes() {
         append(new byte[0]);
--- a/modules/javafx.web/src/test/java/test/com/sun/webkit/SimpleSharedBufferInputStreamTest.java	Wed Jan 03 15:30:19 2018 +0530
+++ b/modules/javafx.web/src/test/java/test/com/sun/webkit/SimpleSharedBufferInputStreamTest.java	Mon Jan 08 12:55:16 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 import java.util.Random;
 import org.junit.After;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -166,13 +165,6 @@
         assertArrayEquals(g(SEGMENT_SIZE - 10, 10), read(10));
     }
 
-    @Test @Ignore
-    public void testRead3FirstSegmentLastTenBytesWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        readOut(SEGMENT_SIZE - 5);
-        assertArrayEquals(g(SEGMENT_SIZE - 5, 5), read(10));
-    }
-
     @Test
     public void testRead3InteriorSegmentFirstTenBytes() {
         append(SEGMENT_SIZE * 2.5);
@@ -194,13 +186,6 @@
         assertArrayEquals(g(SEGMENT_SIZE * 2 - 10, 10), read(10));
     }
 
-    @Test @Ignore
-    public void testRead3InteriorSegmentLastTenBytesWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        readOut(SEGMENT_SIZE * 2 - 5);
-        assertArrayEquals(g(SEGMENT_SIZE * 2 - 5, 5), read(10));
-    }
-
     @Test
     public void testRead3LastSegmentFirstTenBytes() {
         append(SEGMENT_SIZE * 2.5);
@@ -247,15 +232,6 @@
         assertArrayEquals(g(0, SEGMENT_SIZE), read(SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testRead3FirstSegmentWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        readOut(SEGMENT_SIZE * 0.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE * 0.5, SEGMENT_SIZE - SEGMENT_SIZE * 0.5),
-                read(SEGMENT_SIZE));
-    }
-
     @Test
     public void testRead3InteriorSegment() {
         append(SEGMENT_SIZE * 2.5);
@@ -263,15 +239,6 @@
         assertArrayEquals(g(SEGMENT_SIZE, SEGMENT_SIZE), read(SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testRead3InteriorSegmentWithTruncation() {
-        append(SEGMENT_SIZE * 2.5);
-        readOut(SEGMENT_SIZE * 1.5);
-        assertArrayEquals(
-                g(SEGMENT_SIZE * 1.5, SEGMENT_SIZE - SEGMENT_SIZE * 0.5),
-                read(SEGMENT_SIZE));
-    }
-
     @Test
     public void testRead3LastSegment() {
         append(SEGMENT_SIZE * 2.5);
@@ -381,30 +348,6 @@
         } catch (IndexOutOfBoundsException expected) {}
     }
 
-    @Test @Ignore
-    public void testRead3StandardUse() {
-        int streamSize = 24700;
-        append(streamSize);
-        int numberOfReads = streamSize / SEGMENT_SIZE + 1;
-        for (int i = 0; i < numberOfReads; i++) {
-            byte[] buffer = new byte[8192];
-            int len = is.read(buffer, 0, buffer.length);
-            int expectedLen = i == numberOfReads - 1
-                    ? streamSize % SEGMENT_SIZE : SEGMENT_SIZE;
-            assertEquals(expectedLen, len);
-            byte[] expectedBuffer = new byte[8192];
-            System.arraycopy(g(SEGMENT_SIZE * i, SEGMENT_SIZE), 0,
-                             expectedBuffer, 0,
-                             len);
-            assertArrayEquals(expectedBuffer, buffer);
-        }
-
-        byte[] buffer = new byte[8192];
-        int len = is.read(buffer, 0, buffer.length);
-        assertEquals(-1, len);
-        assertArrayEquals(new byte[8192], buffer);
-    }
-
     private void testSkipSmallNumberOfBytes(long skip) {
         int streamSize = (int) (SEGMENT_SIZE * 2.5);
         int skipCount = streamSize / SEGMENT_SIZE + 1;
@@ -420,16 +363,6 @@
         }
     }
 
-    @Test @Ignore
-    public void testSkipOneByte() {
-        testSkipSmallNumberOfBytes(1);
-    }
-
-    @Test @Ignore
-    public void testSkipTenBytes() {
-        testSkipSmallNumberOfBytes(10);
-    }
-
     @Test
     public void testSkipZeroBytes() {
         testSkipSmallNumberOfBytes(0);
@@ -573,23 +506,6 @@
         assertArrayEquals(g(0, SEGMENT_SIZE), read(SEGMENT_SIZE));
     }
 
-    @Test @Ignore
-    public void testCloseBeforeSubsequentRead() throws IOException {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(g(0, 10), read(10));
-        is.close();
-        assertArrayEquals(g(10, SEGMENT_SIZE - 10), read(SEGMENT_SIZE));
-    }
-
-    @Test @Ignore
-    public void testDoubleClose() throws IOException {
-        append(SEGMENT_SIZE * 2.5);
-        assertArrayEquals(g(0, 10), read(10));
-        is.close();
-        is.close();
-        assertArrayEquals(g(10, SEGMENT_SIZE - 10), read(SEGMENT_SIZE));
-    }
-
     @Test
     public void testCloseEmptyBuffer() throws IOException {
         is.close();