Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001.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.description;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 description()40* Assertion: "Returns a human-readable description of this41* argument and its purpose."42*/4344public class description001 {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();55List acl = vmm.allConnectors();5657if (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}75log.display("Looking over " + c.name() + " connector arguments: ");7677Iterator argi = ks.iterator();78for (int j = 1; argi.hasNext(); j++) {79String argkey = (String) argi.next();80Connector.Argument argval =81(Connector.Argument)cdfltArgmnts.get((Object) argkey);82String dscrptn = argval.description();8384if (dscrptn == null) {85log.complain("FAILURE: argument description is null "86+ "for " + argkey + " argument of " + c.name()87+ " connector!");88return 2;89}9091if (dscrptn.length() < 1) {92log.complain("FAILURE: empty argument description is found "93+ "for " + argkey + " argument of " + c.name()94+ " connector!");95return 2;96}9798log.display(j + "," + argval.name() + ": " + dscrptn);99};100};101log.display("Test PASSED!");102return 0;103}104}105106107