jdk/test/javax/management/descriptor/DescriptorConstructorTest.java
changeset 4159 9e3aae7675f1
parent 4158 0b4d21bc8b5c
parent 4156 acaa49a2768a
child 4160 bda0a85afcb7
equal deleted inserted replaced
4158:0b4d21bc8b5c 4159:9e3aae7675f1
     1 /*
       
     2  * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    21  * have any questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug 6501362
       
    27  * @summary DescriptorSupport(String) could recognize "name=value" as well as XML format
       
    28  * @author Jean-Francois Denise
       
    29  * @run clean DescriptorConstructorTest
       
    30  * @run build DescriptorConstructorTest
       
    31  * @run main DescriptorConstructorTest
       
    32  */
       
    33 
       
    34 import javax.management.modelmbean.DescriptorSupport;
       
    35 
       
    36 public class DescriptorConstructorTest {
       
    37     public static void main(String[] args) throws Exception {
       
    38         DescriptorSupport d1 = new DescriptorSupport("MyName1=MyValue1");
       
    39         if(!d1.getFieldValue("MyName1").equals("MyValue1"))
       
    40             throw new Exception("Invalid parsing");
       
    41         DescriptorSupport d2 = new DescriptorSupport("<Descriptor>" +
       
    42                 "<field name=\"MyName2\" value=\"MyValue2\"></field></Descriptor>");
       
    43         if(!d2.getFieldValue("MyName2").equals("MyValue2"))
       
    44             throw new Exception("Invalid parsing");
       
    45     }
       
    46 }