jdk/test/javax/management/loading/MLetInternalsTest.java
author ykantser
Thu, 07 May 2015 09:11:49 +0200
changeset 30376 2ccf2cf7ea48
parent 26484 871db348e647
child 42338 a60f280f803c
permissions -rw-r--r--
8078896: Add @modules as needed to the jdk_svc tests Reviewed-by: alanb, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26484
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 26484
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
26484
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     4
 *
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     7
 * published by the Free Software Foundation.
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     8
 *
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    13
 * accompanied this code).
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    14
 *
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    18
 *
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    21
 * questions.
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    22
 */
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    23
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    24
import java.lang.reflect.Method;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    25
import java.util.HashMap;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    26
import java.util.Map;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    27
import javax.management.loading.MLet;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    28
import org.testng.annotations.Test;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    29
import org.testng.annotations.BeforeClass;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    30
import org.testng.annotations.BeforeTest;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    31
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    32
import static org.testng.Assert.*;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    33
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    34
/*
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    35
 * @test
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    36
 * @bug 8058089
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    37
 * @summary Tests various internal functions provided by MLet for correctness
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    38
 * @author Jaroslav Bachorik
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 26484
diff changeset
    39
 * @modules java.management
26484
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    40
 * @run testng MLetInternalsTest
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    41
 */
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    42
public class MLetInternalsTest {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    43
    private final static String CONSTRUCT_PARAMETER = "constructParameter";
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    44
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    45
    private final static Map<String, Method> testedMethods = new HashMap<>();
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    46
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    47
    @BeforeClass
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    48
    public static void setupClass() {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    49
        testedMethods.clear();
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    50
        try {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    51
            Method m = MLet.class.getDeclaredMethod(
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    52
                    CONSTRUCT_PARAMETER,
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    53
                    String.class, String.class
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    54
            );
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    55
            m.setAccessible(true);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    56
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    57
            testedMethods.put(CONSTRUCT_PARAMETER, m);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    58
        } catch (Exception ex) {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    59
            throw new Error(ex);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    60
        }
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    61
    }
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    62
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    63
    private MLet mlet;
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    64
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    65
    @BeforeTest
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    66
    public void setupTest() {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    67
        mlet = new MLet();
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    68
    }
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    69
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    70
    @Test
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    71
    public void testConstructParameter() throws Exception {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    72
        assertEquals(constructParameter("120", "int"), 120);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    73
        assertEquals(constructParameter("120", "java.lang.Integer"), Integer.valueOf(120));
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    74
        assertEquals(constructParameter("120", "long"), 120L);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    75
        assertEquals(constructParameter("120", "java.lang.Long"), Long.valueOf(120));
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    76
        assertEquals(constructParameter("120.0", "float"), 120.0f);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    77
        assertEquals(constructParameter("120.0", "java.lang.Float"), Float.valueOf(120.0f));
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    78
        assertEquals(constructParameter("120.0", "double"), 120.0d);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    79
        assertEquals(constructParameter("120", "java.lang.Double"), Double.valueOf(120d));
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    80
        assertEquals(constructParameter("120", "java.lang.String"), "120");
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    81
        assertEquals(constructParameter("120", "byte"), (byte)120);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    82
        assertEquals(constructParameter("120", "java.lang.Byte"), (byte)120);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    83
        assertEquals(constructParameter("120", "short"), (short)120);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    84
        assertEquals(constructParameter("120", "java.lang.Short"), (short)120);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    85
        assertEquals(constructParameter("true", "boolean"), true);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    86
        assertEquals(constructParameter("true", "java.lang.Boolean"), Boolean.valueOf(true));
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    87
    }
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    88
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    89
    private Object constructParameter(String param, String type) throws Exception {
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    90
        return testedMethods.get(CONSTRUCT_PARAMETER).invoke(mlet, param, type);
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    91
    }
871db348e647 8058089: api/javax_management/loading/MLetArgsSupport.html\#MLetArgsSupportTest0001 fails because of java.lang.IllegalArgumentException (argument type mismatch)
jbachorik
parents:
diff changeset
    92
}