< prev index next >

jdk/test/java/lang/StringBuilder/CompactStringBuilderSerialization.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 StringBuilder serialization
  38  *          among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuilder
  39  * @run testng/othervm -XX:+CompactStrings CompactStringBuilderSerialization
  40  * @run testng/othervm -XX:-CompactStrings CompactStringBuilderSerialization
  41  */
  42 
  43 public class CompactStringBuilderSerialization {
  44     @DataProvider
  45     public Object[][] provider() {
  46         return new Object[][] {
  47                 // every byte array is serialized from corresponding StringBuffer object
  48                 // by previous JDK(build 1.8.0_45-b14).
  49                 new Object[] {
  50                         new StringBuilder(""),
  51                         new byte[] { -84, -19, 0, 5, 115, 114, 0, 23, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 83, 116, 114, 105, 110, 103, 66, 117, 105,
  52                                 108, 100, 101, 114, 60, -43, -5, 20, 90, 76, 106, -53, 3, 0, 0, 120, 112, 119, 4, 0, 0, 0, 0, 117, 114, 0, 2, 91, 67, -80, 38,
  53                                 102, -80, -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,
  54                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120 } },
  55                 new Object[] {
  56                         new StringBuilder("A"),


   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 StringBuilder serialization
  37  *          among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuilder
  38  * @run testng/othervm -XX:+CompactStrings CompactStringBuilderSerialization
  39  * @run testng/othervm -XX:-CompactStrings CompactStringBuilderSerialization
  40  */
  41 
  42 public class CompactStringBuilderSerialization {
  43     @DataProvider
  44     public Object[][] provider() {
  45         return new Object[][] {
  46                 // every byte array is serialized from corresponding StringBuffer object
  47                 // by previous JDK(build 1.8.0_45-b14).
  48                 new Object[] {
  49                         new StringBuilder(""),
  50                         new byte[] { -84, -19, 0, 5, 115, 114, 0, 23, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 83, 116, 114, 105, 110, 103, 66, 117, 105,
  51                                 108, 100, 101, 114, 60, -43, -5, 20, 90, 76, 106, -53, 3, 0, 0, 120, 112, 119, 4, 0, 0, 0, 0, 117, 114, 0, 2, 91, 67, -80, 38,
  52                                 102, -80, -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,
  53                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120 } },
  54                 new Object[] {
  55                         new StringBuilder("A"),


< prev index next >