jdk/test/javax/management/openmbean/EqualsTest.java
author dbuck
Tue, 18 Aug 2015 04:29:28 -0700
changeset 32417 6859107fc6c3
parent 30376 2ccf2cf7ea48
child 44423 306c020eb154
permissions -rw-r--r--
8133666: OperatingSystemMXBean reports abnormally high machine CPU consumption on Linux Reviewed-by: sla, mgronlun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 5506
diff changeset
     2
 * Copyright (c) 2005, 2015, 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
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 5506
diff changeset
    29
 * @modules java.management
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @run clean EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run build EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @run main EqualsTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.management.ObjectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.management.openmbean.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
public class EqualsTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     * Print message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private static void echo(String message) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        System.out.println(message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * Main
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        echo("=-=-= Test CompositeDataSupport.equals() with ArrayType =-=-=");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        echo(">>> Two SimpleTypes with different descriptions");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        CompositeType ct1 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                    new String[] {"a_desc", "b_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                    new OpenType[] {SimpleType.BOOLEAN,SimpleType.STRING});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        CompositeType ct2 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                    new String[] {"aa_desc", "bb_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                    new OpenType[] {SimpleType.BOOLEAN, SimpleType.STRING});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        if (!ct1.equals(ct2)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            throw new RuntimeException("CompositeType.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        if (ct1.hashCode() != ct2.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
            throw new RuntimeException("CompositeType.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        echo(">>> Two SimpleTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        CompositeData compositeData0 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                    ct1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                    new Object[] {new Boolean(true), ""});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        CompositeData compositeData1 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                    ct2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                    new Object[] {new Boolean(true), ""});
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (!compositeData0.equals(compositeData1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        if (compositeData0.hashCode() != compositeData1.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        echo(">>> Two ArrayTypes with different references");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        CompositeType ct3 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                    new OpenType[] {new ArrayType(1, SimpleType.STRING)});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        CompositeData compositeData2 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                    new Object[] {new String[] {"x", "y"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        CompositeData compositeData3 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                    new Object[] {new String[] {"x", "y"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        if (!compositeData2.equals(compositeData3)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        if (compositeData2.hashCode() != compositeData3.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        echo(">>> Two ArrayTypes with different values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        CompositeData compositeData4 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                    ct3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                    new Object[] {new String[] {"x", "y", "x"}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if (compositeData2.equals(compositeData4)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        echo(">>> Two 2-dimension ArrayTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        CompositeType ct4 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                    new OpenType[] {new ArrayType(2, SimpleType.OBJECTNAME)});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        final String s = "t:t=t";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        CompositeData compositeData5 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    ct4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                    new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                        new ObjectName[][] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                                new ObjectName(s), new ObjectName(s)
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        CompositeData compositeData6 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                    ct4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                    new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                        new ObjectName[][] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                                new ObjectName(s), new ObjectName(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                            new ObjectName[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                new ObjectName(s), new ObjectName(s)
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        if (!compositeData5.equals(compositeData6)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        if (compositeData5.hashCode() != compositeData6.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        echo(">>> Two primitive ArrayTypes with different descriptions");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        CompositeType ct5 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    new String[] {"a_desc", "b_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        SimpleType.BOOLEAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                        ArrayType.getPrimitiveArrayType(short[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        CompositeType ct6 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                    new String[] {"a", "b"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                    new String[] {"aa_desc", "bb_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                        SimpleType.BOOLEAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                        ArrayType.getPrimitiveArrayType(short[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        if (!ct5.equals(ct6)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            throw new RuntimeException("CompositeType.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if (ct5.hashCode() != ct6.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            throw new RuntimeException("CompositeType.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        echo(">>> Two primitive ArrayTypes with different references");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        CompositeType ct7 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                        ArrayType.getPrimitiveArrayType(int[].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        CompositeData compositeData7 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                    new Object[] {new int[] {1, 2}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        CompositeData compositeData8 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                    new Object[] {new int[] {1, 2}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        if (!compositeData7.equals(compositeData8)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        if (compositeData7.hashCode() != compositeData8.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        echo(">>> Two primitive ArrayTypes with different values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        CompositeData compositeData9 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                    ct7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                    new Object[] {new int[] {1, 2, 3}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        if (compositeData7.equals(compositeData9)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        echo(">>> Two 2-dimension primitive ArrayTypes with equal values");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        CompositeType ct8 = new CompositeType(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                    "MyType",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                    "for test",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    new String[] {"a_desc"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                    new OpenType[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                        ArrayType.getPrimitiveArrayType(boolean[][].class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                    });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        CompositeData compositeData10 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                    ct8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                    new Object[] {new boolean[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                          {new boolean[] {true, true},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                           new boolean[] {true, true}}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        CompositeData compositeData11 = new CompositeDataSupport(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                    ct8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                    new String[] {"a"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                    new Object[] {new boolean[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                          {new boolean[] {true, true},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                           new boolean[] {true, true}}});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        if (!compositeData10.equals(compositeData11)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            throw new RuntimeException("CompositeDataSupport.equals fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        if (compositeData10.hashCode() != compositeData11.hashCode()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            throw new RuntimeException("CompositeDataSupport.hashCode fails!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
}