Path: blob/master/test/jdk/java/beans/XMLEncoder/Test4993777.java
41152 views
/*1* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 499377726* @summary Tests encoding of multi-dimensional arrays27* @run main/othervm -Djava.security.manager=allow Test499377728* @author Sergey Malenkov29*/3031public final class Test4993777 extends AbstractTest {32public static void main(String[] args) {33new Test4993777().test(true);34}3536protected ArrayBean getObject() {37ArrayBean data = new ArrayBean();38data.setArray(39new InnerObject("one"),40new InnerObject("two")41);42return data;43}4445protected ArrayBean getAnotherObject() {46ArrayBean data = new ArrayBean();47data.setArray2D(48new InnerObject[] {49new InnerObject("1"),50new InnerObject("2"),51new InnerObject("3"),52},53new InnerObject[] {54new InnerObject("4"),55new InnerObject("5"),56new InnerObject("6"),57}58);59return data;60}6162public static final class ArrayBean {63private InnerObject[] array;64private InnerObject[][] array2D;6566public InnerObject[] getArray() {67return this.array;68}6970public void setArray(InnerObject... array) {71this.array = array;72}7374public InnerObject[][] getArray2D() {75return this.array2D;76}7778public void setArray2D(InnerObject[]... array2D) {79this.array2D = array2D;80}81}8283public static final class InnerObject {84private String name;8586public InnerObject() {87}8889private InnerObject(String name) {90this.name = name;91}9293public String getName() {94return this.name;95}9697public void setName(String name) {98this.name = name;99}100}101}102103104