< prev index next >

test/java/lang/StringBuilder/CompactStringBuilderSerialization.java

Print this page
rev 17324 : 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
Reviewed-by: duke


  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"),




  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  * @build jdk.test.lib.util.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"),


< prev index next >