Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java
41161 views
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.name;
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 name()
41
* Assertion: "Returns a short, unique identifier for the argument."
42
*/
43
44
public class name001 {
45
private static Log log;
46
47
public static void main( String argv[] ) {
48
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
49
}
50
51
public static int run(String argv[],PrintStream out) {
52
ArgumentHandler argHandler = new ArgumentHandler(argv);
53
log = new Log(out, argHandler);
54
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
55
56
List acl = vmm.allConnectors();
57
if (acl.size() > 0) {
58
log.display("Number of all known JDI connectors: " + acl.size());
59
} else {
60
log.complain("FAILURE: no JDI connectors found!");
61
return 2;
62
}
63
64
Iterator aci = acl.iterator();
65
for (int i = 1; aci.hasNext(); i++) {
66
Connector c = (Connector) aci.next();
67
Map cdfltArgmnts = c.defaultArguments();
68
int ksz = cdfltArgmnts.size();
69
String ids[] = new String[ksz + 1];
70
Set ks = cdfltArgmnts.keySet();
71
if (ks.isEmpty()) {
72
log.complain("FAILURE: empty default arguments set is found "
73
+ "for " + c.name() + " connector!");
74
return 2;
75
}
76
77
log.display("Looking over " + c.name() + " connector arguments: ");
78
79
Iterator argi = ks.iterator();
80
for (int j = 1; argi.hasNext(); j++) {
81
String argkey = (String) argi.next();
82
Connector.Argument argval =
83
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
84
String idntfr = argval.name();
85
86
if (idntfr == null) {
87
log.complain("FAILURE: argument identifier is null "
88
+ "for " + argkey + " argument of " + c.name()
89
+ " connector!");
90
return 2;
91
}
92
if (idntfr.length() < 1) {
93
log.complain("FAILURE: empty argument identifier is found "
94
+ "for " + argkey + " argument of " + c.name()
95
+ " connector!");
96
return 2;
97
}
98
99
for (int k = 1; k < j && j > 1; k++) {
100
log.display("ids[" + k + "] = " + ids[k]);
101
if (ids[k].equals(idntfr)) {
102
log.complain("FAILURE: identifier of argument "
103
+ "value isn't unique ( " + idntfr + ")!");
104
return 2;
105
}
106
}
107
ids[j] = idntfr;
108
log.display("Next (" + j + ") argument's identifier is: "
109
+ argval.name());
110
};
111
};
112
log.display("Test PASSED!");
113
return 0;
114
}
115
}
116
117