Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/management/ObjectName/DelegateNameWildcardNameTest.java
38838 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 478040026* @summary Test that MBeanServerDelegate.DELEGATE_NAME and ObjectName.WILDCARD27* public constants have been initialized properly.28* @author Luis-Miguel Alventosa29* @run clean DelegateNameWildcardNameTest30* @run build DelegateNameWildcardNameTest31* @run main DelegateNameWildcardNameTest32*/3334import javax.management.MBeanServerDelegate;35import javax.management.ObjectName;3637public class DelegateNameWildcardNameTest {3839public static void main(String[] args) throws Exception {4041System.out.println(42"Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +43"<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");44final ObjectName delegateName =45new ObjectName("JMImplementation:type=MBeanServerDelegate");46if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))47throw new AssertionError("Unexpected value: " +48"MBeanServerDelegate.DELEGATE_NAME = " +49MBeanServerDelegate.DELEGATE_NAME);50System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +51"new ObjectName(\"" + delegateName + "\")");5253System.out.println("Test that <ObjectName.WILDCARD> " +54"equals <new ObjectName(\"*:*\")>");55final ObjectName wildcardName = new ObjectName("*:*");56if (!wildcardName.equals(ObjectName.WILDCARD))57throw new AssertionError("Unexpected value: " +58"ObjectName.WILDCARD = " +59ObjectName.WILDCARD);60System.out.println("ObjectName.WILDCARD = " +61"new ObjectName(\"" + wildcardName + "\")");6263System.out.println("Test passes: constants were initialized properly");64}65}666768