Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001.java
41160 views
/*1* Copyright (c) 2000, 2018, 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*/2223package nsk.jdi.Argument.label;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829import com.sun.jdi.*;30import com.sun.jdi.connect.Connector;31import java.io.*;32import javax.naming.directory.Attribute;33import java.util.*;3435/**36* Test for the control of37*38* Interface: com.sun.jdi.connect.Connector.Argument39* Method: public java.lang.String label()40* Assertion: "Returns a short human-readable label for41* this argument."42*/4344public class label001 {45private static Log log;4647public static void main( String argv[] ) {48System.exit(run(argv, System.out)+95); // JCK-compatible exit status49}5051public static int run(String argv[], PrintStream out) {52ArgumentHandler argHandler = new ArgumentHandler(argv);53log = new Log(out, argHandler);54VirtualMachineManager vmm = Bootstrap.virtualMachineManager();5556List acl = vmm.allConnectors();57if (acl.size() > 0) {58log.display("Number of all known JDI connectors: " + acl.size());59} else {60log.complain("FAILURE: no JDI connectors found!");61return 2;62}6364Iterator aci = acl.iterator();65for (int i = 1; aci.hasNext(); i++) {66Connector c = (Connector) aci.next();67Map cdfltArgmnts = c.defaultArguments();68Set ks = cdfltArgmnts.keySet();6970if (ks.isEmpty()) {71log.complain("FAILURE: empty default arguments set is found "72+ "for " + c.name() + " connector!");73return 2;74}7576log.display("Looking over " + c.name() + " connector arguments: ");7778Iterator argi = ks.iterator();79for (int j = 1; argi.hasNext(); j++) {80String argkey = (String) argi.next();81Connector.Argument argval =82(Connector.Argument)cdfltArgmnts.get((Object) argkey);83String lbl = argval.label();8485if (lbl == null) {86log.complain("FAILURE: argument label is null "87+ "for " + argkey + " argument of "88+ c.name() + " connector!");89return 2;90}9192if (lbl.length() < 1) {93log.complain("FAILURE: empty argument label is found "94+ "for " + argkey + " argument of "95+ c.name() + " connector!");96return 2;97}9899log.display("Next (" + j + ") argument's label is: " + lbl);100};101};102log.display("Test PASSED!");103return 0;104}105}106107108