blob: e344a2f6738f3fc22014a62e4b249681035eeb35 [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001/*
2 * Copyright 2006-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 */
23
24/*
25 * @test
26 * @bug 4993777
27 * @summary Tests encoding of multi-dimensional arrays
28 * @author Sergey Malenkov
29 */
30
31public final class Test4993777 extends AbstractTest {
32 public static void main(String[] args) {
33 new Test4993777().test(true);
34 }
35
36 protected ArrayBean getObject() {
37 ArrayBean data = new ArrayBean();
38 data.setArray(
39 new InnerObject("one"),
40 new InnerObject("two")
41 );
42 return data;
43 }
44
45 protected ArrayBean getAnotherObject() {
46 ArrayBean data = new ArrayBean();
47 data.setArray2D(
48 new InnerObject[] {
49 new InnerObject("1"),
50 new InnerObject("2"),
51 new InnerObject("3"),
52 },
53 new InnerObject[] {
54 new InnerObject("4"),
55 new InnerObject("5"),
56 new InnerObject("6"),
57 }
58 );
59 return data;
60 }
61
62 public static final class ArrayBean {
63 private InnerObject[] array;
64 private InnerObject[][] array2D;
65
66 public InnerObject[] getArray() {
67 return this.array;
68 }
69
70 public void setArray(InnerObject... array) {
71 this.array = array;
72 }
73
74 public InnerObject[][] getArray2D() {
75 return this.array2D;
76 }
77
78 public void setArray2D(InnerObject[]... array2D) {
79 this.array2D = array2D;
80 }
81 }
82
83 public static final class InnerObject {
84 private String name;
85
86 public InnerObject() {
87 }
88
89 private InnerObject(String name) {
90 this.name = name;
91 }
92
93 public String getName() {
94 return this.name;
95 }
96
97 public void setName(String name) {
98 this.name = name;
99 }
100 }
101}