1 /* 2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package nsk.jdi.Argument.description; 25 26 import nsk.share.*; 27 import nsk.share.jpda.*; 28 import nsk.share.jdi.*; 29 30 import com.sun.jdi.*; 31 import com.sun.jdi.connect.Connector; 32 import java.io.*; 33 import javax.naming.directory.Attribute; 34 import java.util.*; 35 36 /** 37 * Test for the control of 38 * 39 * Interface: com.sun.jdi.connect.Connector.Argument 40 * Method: public java.lang.String description() 41 * Assertion: "Returns a human-readable description of this 42 * argument and its purpose." 43 */ 44 45 public class description001 { 46 private static Log log; 47 main( String argv[] )48 public static void main( String argv[] ) { 49 System.exit(run(argv, System.out)+95); // JCK-compatible exit status 50 } 51 run(String argv[], PrintStream out)52 public static int run(String argv[], PrintStream out) { 53 ArgumentHandler argHandler = new ArgumentHandler(argv); 54 log = new Log(out, argHandler); 55 VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 56 List acl = vmm.allConnectors(); 57 58 if (acl.size() > 0) { 59 log.display("Number of all known JDI connectors: " + acl.size()); 60 } else { 61 log.complain("FAILURE: no JDI connectors found!"); 62 return 2; 63 } 64 65 Iterator aci = acl.iterator(); 66 for (int i = 1; aci.hasNext(); i++) { 67 Connector c = (Connector) aci.next(); 68 Map cdfltArgmnts = c.defaultArguments(); 69 Set ks = cdfltArgmnts.keySet(); 70 71 if (ks.isEmpty()) { 72 log.complain("FAILURE: empty default arguments set is found " 73 + "for " + c.name() + " connector!"); 74 return 2; 75 } 76 log.display("Looking over " + c.name() + " connector arguments: "); 77 78 Iterator argi = ks.iterator(); 79 for (int j = 1; argi.hasNext(); j++) { 80 String argkey = (String) argi.next(); 81 Connector.Argument argval = 82 (Connector.Argument)cdfltArgmnts.get((Object) argkey); 83 String dscrptn = argval.description(); 84 85 if (dscrptn == null) { 86 log.complain("FAILURE: argument description is null " 87 + "for " + argkey + " argument of " + c.name() 88 + " connector!"); 89 return 2; 90 } 91 92 if (dscrptn.length() < 1) { 93 log.complain("FAILURE: empty argument description is found " 94 + "for " + argkey + " argument of " + c.name() 95 + " connector!"); 96 return 2; 97 } 98 99 log.display(j + "," + argval.name() + ": " + dscrptn); 100 }; 101 }; 102 log.display("Test PASSED!"); 103 return 0; 104 } 105 } 106