jdk/test/javax/management/query/QueryMatchTest.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
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 6266438
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Query.match code for character sequences like [a-z] is wrong.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @author Luis-Miguel Alventosa
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * @run clean QueryMatchTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @run build QueryMatchTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run main QueryMatchTest
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 java.lang.management.ManagementFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.management.MBeanServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.management.ObjectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.management.Query;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.management.QueryExp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
public class QueryMatchTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    public static interface SimpleMBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        public String getStringNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    public static class Simple implements SimpleMBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        public Simple(String number) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            this.number = number;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        public String getStringNumber() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
            return number;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        private String number;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    // Pattern = 2[7-9]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static String[][] data11 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        { "20", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        { "21", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        { "22", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        { "23", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        { "24", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        { "25", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        { "26", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        { "27", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        { "28", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        { "29", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        { "2-", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    // Pattern = 2[7-9]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private static String[][] data12 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        { "205", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        { "215", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        { "225", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        { "235", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        { "245", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        { "255", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        { "265", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        { "275", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        { "285", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        { "295", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        { "2-5", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    // Pattern = 2[-9]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    private static String[][] data13 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        { "20", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        { "21", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        { "22", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        { "23", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        { "24", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        { "25", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        { "26", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        { "27", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        { "28", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        { "29", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        { "2-", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    // Pattern = 2[-9]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    private static String[][] data14 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        { "205", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        { "215", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        { "225", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        { "235", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        { "245", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        { "255", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        { "265", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        { "275", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        { "285", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        { "295", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        { "2-5", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    // Pattern = 2[9-]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    private static String[][] data15 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        { "20", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        { "21", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        { "22", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        { "23", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        { "24", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        { "25", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        { "26", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        { "27", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        { "28", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        { "29", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        { "2-", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    // Pattern = 2[9-]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    private static String[][] data16 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        { "205", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        { "215", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        { "225", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        { "235", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        { "245", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        { "255", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        { "265", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        { "275", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        { "285", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        { "295", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        { "2-5", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    // Pattern = 2[-]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    private static String[][] data17 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        { "20", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        { "21", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        { "22", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        { "23", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        { "24", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        { "25", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        { "26", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        { "27", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        { "28", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        { "29", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        { "2-", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    // Pattern = 2[-]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    private static String[][] data18 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        { "205", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        { "215", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        { "225", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        { "235", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        { "245", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        { "255", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        { "265", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        { "275", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        { "285", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        { "295", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        { "2-5", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    // Pattern = 2[1-36-8]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    private static String[][] data19 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        { "20", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        { "21", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        { "22", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        { "23", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        { "24", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        { "25", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        { "26", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        { "27", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        { "28", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        { "29", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        { "2-", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    // Pattern = 2[1-36-8]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    private static String[][] data20 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        { "205", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        { "215", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        { "225", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        { "235", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        { "245", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        { "255", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        { "265", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        { "275", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        { "285", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        { "295", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        { "2-5", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    // Pattern = 2[!7-9]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    private static String[][] data21 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        { "20", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        { "21", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        { "22", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        { "23", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        { "24", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        { "25", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        { "26", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        { "27", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        { "28", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        { "29", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        { "2-", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    // Pattern = 2[!7-9]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    private static String[][] data22 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        { "205", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        { "215", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        { "225", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        { "235", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        { "245", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        { "255", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        { "265", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        { "275", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        { "285", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        { "295", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        { "2-5", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    // Pattern = 2[!-9]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    private static String[][] data23 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        { "20", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        { "21", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        { "22", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        { "23", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        { "24", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        { "25", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        { "26", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        { "27", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        { "28", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        { "29", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        { "2-", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    // Pattern = 2[!-9]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    private static String[][] data24 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        { "205", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        { "215", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        { "225", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        { "235", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        { "245", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        { "255", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        { "265", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        { "275", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        { "285", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        { "295", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        { "2-5", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    // Pattern = 2[!9-]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    private static String[][] data25 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        { "20", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        { "21", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        { "22", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        { "23", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        { "24", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        { "25", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        { "26", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        { "27", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        { "28", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        { "29", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        { "2-", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    // Pattern = 2[!9-]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    private static String[][] data26 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        { "205", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        { "215", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        { "225", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        { "235", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        { "245", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        { "255", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        { "265", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        { "275", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        { "285", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        { "295", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        { "2-5", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    // Pattern = 2[!-]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    private static String[][] data27 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        { "20", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        { "21", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        { "22", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        { "23", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        { "24", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        { "25", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        { "26", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        { "27", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        { "28", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        { "29", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        { "2-", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    // Pattern = 2[!-]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    private static String[][] data28 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        { "205", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        { "215", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        { "225", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        { "235", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        { "245", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        { "255", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        { "265", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        { "275", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        { "285", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        { "295", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        { "2-5", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    // Pattern = 2[!1-36-8]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    private static String[][] data29 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        { "20", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        { "21", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        { "22", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        { "23", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        { "24", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        { "25", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        { "26", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        { "27", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        { "28", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        { "29", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        { "2-", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    // Pattern = 2[!1-36-8]5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    private static String[][] data30 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        { "205", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        { "215", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        { "225", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        { "235", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        { "245", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        { "255", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        { "265", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        { "275", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        { "285", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        { "295", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        { "2-5", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    // Pattern = a*b?c[d-e]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    private static String[][] data31 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        { "a*b?cd", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        { "a*b?ce", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        { "a*b?cde", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        { "[a]*b?[c]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        { "abc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        { "ab?c", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        { "a*bc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        { "axxbxc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        { "axxbxcd", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    // Pattern = a\*b\?c\[d-e]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    private static String[][] data32 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        { "a*b?cd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        { "a*b?ce", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        { "a*b?cde", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        { "[a]*b?[c]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        { "abc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        { "ab?c", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        { "a*bc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        { "axxbxc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        { "axxbxcd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        { "a*b?c[d]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        { "a*b?c[e]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        { "a*b?c[d-e]", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    // Pattern = a\*b\?c\[de]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    private static String[][] data33 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        { "a*b?cd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        { "a*b?ce", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        { "a*b?cde", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        { "[a]*b?[c]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        { "abc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        { "ab?c", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        { "a*bc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        { "axxbxc", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        { "axxbxcd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        { "a*b?c[d]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        { "a*b?c[e]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        { "a*b?c[d-e]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        { "a*b?c[de]", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    // Pattern = abc[de]f
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    private static String[][] data34 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        { "abcdf", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        { "abcef", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        { "abcdef", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        { "abcedf", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        { "abcd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        { "abce", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        { "abcf", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    // Pattern = abc[d]e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    private static String[][] data35 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        { "abcde", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        { "abcd", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        { "abcdf", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        { "abcdef", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    // Pattern = a[b]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    private static String[][] data36 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        { "a", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        { "ab", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        { "a[b]", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    // Pattern = a\b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    private static String[][] data37 = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        { "a", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        { "ab", "KO" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        { "a\\b", "OK" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    private static Object[][] tests = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        { "2[7-9]", data11 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        { "2[7-9]5", data12 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        { "2[-9]", data13 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        { "2[-9]5", data14 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        { "2[9-]", data15 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        { "2[9-]5", data16 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        { "2[-]", data17 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        { "2[-]5", data18 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        { "2[1-36-8]", data19 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        { "2[1-36-8]5", data20 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        { "2[!7-9]", data21 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        { "2[!7-9]5", data22 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        { "2[!-9]", data23 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        { "2[!-9]5", data24 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        { "2[!9-]", data25 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        { "2[!9-]5", data26 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        { "2[!-]", data27 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        { "2[!-]5", data28 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        { "2[!1-36-8]", data29 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        { "2[!1-36-8]5", data30 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        { "a*b?c[d-e]", data31 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        { "a\\*b\\?c\\[d-e]", data32 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        { "a\\*b\\?c\\[de]", data33 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        { "abc[de]f", data34 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        { "abc[d]e", data35 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        { "a[b]", data36 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        { "a\\\\b", data37 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    private static int query(MBeanServer mbs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                             String pattern,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
                             String[][] data) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        int error = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        System.out.println("\nAttribute Value Pattern = " + pattern + "\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        for (int i = 0; i < data.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            ObjectName on = new ObjectName("domain:type=Simple,pattern=" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                                           ObjectName.quote(pattern) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                                           ",name=" + i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            Simple s = new Simple(data[i][0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            mbs.registerMBean(s, on);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            QueryExp q =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                Query.match(Query.attr("StringNumber"), Query.value(pattern));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
            q.setMBeanServer(mbs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
            boolean r = q.apply(on);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
            System.out.print("Attribute Value = " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                mbs.getAttribute(on, "StringNumber"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            if (r && "OK".equals(data[i][1])) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                System.out.println(" OK");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
            } else if (!r && "KO".equals(data[i][1])) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                System.out.println(" KO");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                System.out.println(" Error");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                error++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        return error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        int error = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        System.out.println("\n--- Test javax.management.Query.match ---");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        for (int i = 0; i < tests.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            error += query(mbs, (String) tests[i][0], (String[][]) tests[i][1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        if (error > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
            System.out.println("\nTest failed! " + error + " errors.\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            throw new IllegalArgumentException("Test failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            System.out.println("\nTest passed!\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
}