1 // Tags: JDK1.5 |
|
2 |
|
3 // Copyright (C) 2007 Andrew John Hughes <gnu_andrew@member.fsf.org> |
|
4 |
|
5 // This file is part of Mauve. |
|
6 |
|
7 // Mauve is free software; you can redistribute it and/or modify |
|
8 // it under the terms of the GNU General Public License as published by |
|
9 // the Free Software Foundation; either version 2, or (at your option) |
|
10 // any later version. |
|
11 |
|
12 // Mauve is distributed in the hope that it will be useful, |
|
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 // GNU General Public License for more details. |
|
16 |
|
17 // You should have received a copy of the GNU General Public License |
|
18 // along with Mauve; see the file COPYING. If not, write to |
|
19 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
20 // Boston, MA 02111-1307, USA. |
|
21 |
|
22 package gnu.testlet.javax.management.openmbean.ArrayType; |
|
23 |
|
24 import gnu.testlet.TestHarness; |
|
25 import gnu.testlet.Testlet; |
|
26 |
|
27 import javax.management.openmbean.ArrayType; |
|
28 import javax.management.openmbean.OpenDataException; |
|
29 import javax.management.openmbean.SimpleType; |
|
30 |
|
31 /** |
|
32 * Tests {@link ArrayType#getArrayType(OpenType)} |
|
33 * for 1-dimensional simple arrays. |
|
34 * |
|
35 * @author <a href="mailto:gnu_andrew@member.fsf.org">Andrew John Hughes</a> |
|
36 */ |
|
37 public class GetArrayType |
|
38 implements Testlet |
|
39 { |
|
40 |
|
41 public void test(TestHarness h) |
|
42 { |
|
43 ArrayType type = null; |
|
44 try |
|
45 { |
|
46 h.checkPoint("1-dimensional integer array"); |
|
47 type = ArrayType.getArrayType(SimpleType.INTEGER); |
|
48 h.check(type.getClassName(), "[Ljava.lang.Integer;"); |
|
49 h.check(type.getTypeName(), "[Ljava.lang.Integer;"); |
|
50 h.check(type.getElementOpenType().getClassName(), "java.lang.Integer"); |
|
51 h.check(type.getDescription(), "1-dimension array of java.lang.Integer"); |
|
52 } |
|
53 catch (OpenDataException e) |
|
54 { |
|
55 h.debug(e); |
|
56 } |
|
57 try |
|
58 { |
|
59 h.checkPoint("2-dimensional integer array"); |
|
60 type = ArrayType.getArrayType(type); |
|
61 h.check(type.getClassName(), "[[Ljava.lang.Integer;"); |
|
62 h.check(type.getTypeName(), "[[Ljava.lang.Integer;"); |
|
63 h.check(type.getElementOpenType().getClassName(), "java.lang.Integer"); |
|
64 h.check(type.getDescription(), "2-dimension array of java.lang.Integer"); |
|
65 } |
|
66 catch (OpenDataException e) |
|
67 { |
|
68 h.debug(e); |
|
69 } |
|
70 try |
|
71 { |
|
72 h.checkPoint("3-dimensional integer array"); |
|
73 type = ArrayType.getArrayType(type); |
|
74 h.check(type.getClassName(), "[[[Ljava.lang.Integer;"); |
|
75 h.check(type.getTypeName(), "[[[Ljava.lang.Integer;"); |
|
76 h.check(type.getElementOpenType().getClassName(), "java.lang.Integer"); |
|
77 h.check(type.getDescription(), "3-dimension array of java.lang.Integer"); |
|
78 } |
|
79 catch (OpenDataException e) |
|
80 { |
|
81 h.debug(e); |
|
82 } |
|
83 |
|
84 } |
|
85 |
|
86 |
|
87 } |
|