jdk/test/javax/management/openmbean/EqualsTest.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 30376 2ccf2cf7ea48
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 5072174
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Test CompositeDataSupport.equals with ArrayType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @author Shanliang JIANG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * @run clean EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @run build EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run main EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.ObjectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.management.openmbean.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
public class EqualsTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
     * Print message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private static void echo(String message) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        System.out.println(message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * Main
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        echo("=-=-= Test CompositeDataSupport.equals() with ArrayType =-=-=");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        echo(">>> Two SimpleTypes with different descriptions");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        CompositeType ct1 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                    new String[] {"a_desc", "b_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                    new OpenType[] {SimpleType.BOOLEAN,SimpleType.STRING});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        CompositeType ct2 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                    new String[] {"aa_desc", "bb_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                    new OpenType[] {SimpleType.BOOLEAN, SimpleType.STRING});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        if (!ct1.equals(ct2)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            throw new RuntimeException("CompositeType.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        if (ct1.hashCode() != ct2.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
            throw new RuntimeException("CompositeType.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        echo(">>> Two SimpleTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        CompositeData compositeData0 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                    ct1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                    new Object[] {new Boolean(true), ""});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        CompositeData compositeData1 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                    ct2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                    new Object[] {new Boolean(true), ""});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        if (!compositeData0.equals(compositeData1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        if (compositeData0.hashCode() != compositeData1.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        echo(">>> Two ArrayTypes with different references");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        CompositeType ct3 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                    new OpenType[] {new ArrayType(1, SimpleType.STRING)});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        CompositeData compositeData2 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                    new Object[] {new String[] {"x", "y"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        CompositeData compositeData3 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                    new Object[] {new String[] {"x", "y"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        if (!compositeData2.equals(compositeData3)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        if (compositeData2.hashCode() != compositeData3.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        echo(">>> Two ArrayTypes with different values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        CompositeData compositeData4 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                    new Object[] {new String[] {"x", "y", "x"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (compositeData2.equals(compositeData4)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        echo(">>> Two 2-dimension ArrayTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        CompositeType ct4 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                    new OpenType[] {new ArrayType(2, SimpleType.OBJECTNAME)});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        final String s = "t:t=t";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        CompositeData compositeData5 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                    ct4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                    new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                        new ObjectName[][] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        CompositeData compositeData6 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                    ct4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                    new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                        new ObjectName[][] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        if (!compositeData5.equals(compositeData6)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (compositeData5.hashCode() != compositeData6.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        echo(">>> Two primitive ArrayTypes with different descriptions");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        CompositeType ct5 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                    new String[] {"a_desc", "b_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        SimpleType.BOOLEAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        ArrayType.getPrimitiveArrayType(short[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        CompositeType ct6 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                    new String[] {"aa_desc", "bb_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                        SimpleType.BOOLEAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                        ArrayType.getPrimitiveArrayType(short[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        if (!ct5.equals(ct6)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            throw new RuntimeException("CompositeType.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        if (ct5.hashCode() != ct6.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            throw new RuntimeException("CompositeType.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        echo(">>> Two primitive ArrayTypes with different references");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        CompositeType ct7 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                        ArrayType.getPrimitiveArrayType(int[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        CompositeData compositeData7 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                    new Object[] {new int[] {1, 2}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        CompositeData compositeData8 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                    new Object[] {new int[] {1, 2}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        if (!compositeData7.equals(compositeData8)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if (compositeData7.hashCode() != compositeData8.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        echo(">>> Two primitive ArrayTypes with different values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        CompositeData compositeData9 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                    new Object[] {new int[] {1, 2, 3}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        if (compositeData7.equals(compositeData9)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        echo(">>> Two 2-dimension primitive ArrayTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        CompositeType ct8 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                        ArrayType.getPrimitiveArrayType(boolean[][].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        CompositeData compositeData10 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                    ct8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                    new Object[] {new boolean[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                          {new boolean[] {true, true},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                           new boolean[] {true, true}}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        CompositeData compositeData11 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                    ct8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                    new Object[] {new boolean[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                          {new boolean[] {true, true},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                           new boolean[] {true, true}}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        if (!compositeData10.equals(compositeData11)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        if (compositeData10.hashCode() != compositeData11.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
}