< prev index next >

jdk/test/java/lang/StringBuffer/CompactStringBufferSerialization.java

Print this page
rev 16982 : 8180391: move SerializationUtils to top level testlibrary
Reviewed-by: duke
   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.*;
  25 
  26 import org.testng.annotations.DataProvider;
  27 import org.testng.annotations.Test;
  28 
  29 import static jdk.testlibrary.SerializationUtils.*;
  30 import static org.testng.Assert.*;
  31 
  32 /*
  33  * @test
  34  * @bug 8077559
  35  * @library /lib/testlibrary
  36  * @build jdk.testlibrary.SerializationUtils
  37  * @summary Tests Compact String. This one is testing StringBuffer serialization
  38  *          among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuffer
  39  * @run testng/othervm -XX:+CompactStrings CompactStringBufferSerialization
  40  * @run testng/othervm -XX:-CompactStrings CompactStringBufferSerialization
  41  */
  42 
  43 public class CompactStringBufferSerialization {
  44     @DataProvider
  45     public Object[][] provider() {
  46         return new Object[][] {
  47                 // every byte array is serialized from corresponding StringBuilder object
  48                 // by previous JDK(build 1.8.0_45-b14).
  49                 new Object[] {
  50                         new StringBuffer(""),
  51                         new byte[] { -84, -19, 0, 5, 115, 114, 0, 22, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 83, 116, 114, 105, 110, 103, 66, 117, 102,
  52                                 102, 101, 114, 47, 7, 7, -39, -22, -56, -22, -45, 3, 0, 3, 73, 0, 5, 99, 111, 117, 110, 116, 90, 0, 6, 115, 104, 97, 114, 101,
  53                                 100, 91, 0, 5, 118, 97, 108, 117, 101, 116, 0, 2, 91, 67, 120, 112, 0, 0, 0, 0, 0, 117, 114, 0, 2, 91, 67, -80, 38, 102, -80,
  54                                 -30, 93, -124, -84, 2, 0, 0, 120, 112, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  55                                 0, 0, 0, 0, 0, 0, 0, 120 } },
  56                 new Object[] {


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.*;
  25 
  26 import org.testng.annotations.DataProvider;
  27 import org.testng.annotations.Test;
  28 
  29 import static jdk.test.lib.util.SerializationUtils.*;
  30 import static org.testng.Assert.*;
  31 
  32 /*
  33  * @test
  34  * @bug 8077559
  35  * @library /test/lib

  36  * @summary Tests Compact String. This one is testing StringBuffer serialization
  37  *          among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuffer
  38  * @run testng/othervm -XX:+CompactStrings CompactStringBufferSerialization
  39  * @run testng/othervm -XX:-CompactStrings CompactStringBufferSerialization
  40  */
  41 
  42 public class CompactStringBufferSerialization {
  43     @DataProvider
  44     public Object[][] provider() {
  45         return new Object[][] {
  46                 // every byte array is serialized from corresponding StringBuilder object
  47                 // by previous JDK(build 1.8.0_45-b14).
  48                 new Object[] {
  49                         new StringBuffer(""),
  50                         new byte[] { -84, -19, 0, 5, 115, 114, 0, 22, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 83, 116, 114, 105, 110, 103, 66, 117, 102,
  51                                 102, 101, 114, 47, 7, 7, -39, -22, -56, -22, -45, 3, 0, 3, 73, 0, 5, 99, 111, 117, 110, 116, 90, 0, 6, 115, 104, 97, 114, 101,
  52                                 100, 91, 0, 5, 118, 97, 108, 117, 101, 116, 0, 2, 91, 67, 120, 112, 0, 0, 0, 0, 0, 117, 114, 0, 2, 91, 67, -80, 38, 102, -80,
  53                                 -30, 93, -124, -84, 2, 0, 0, 120, 112, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  54                                 0, 0, 0, 0, 0, 0, 0, 120 } },
  55                 new Object[] {


< prev index next >