Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001.java
41813 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.Connector.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.PrintStream;
33
import java.util.*;
34
35
/**
36
* Test for control of
37
*
38
* Interface: com.sun.jdi.connect.Connector
39
* Method: public java.lang.String name()
40
* Assertion: "Returns a short identifier for the connector."
41
*/
42
43
public class name001 {
44
private static Log log;
45
46
public static void main( String argv[] ) {
47
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
48
}
49
50
public static int run(String argv[], PrintStream out) {
51
ArgumentHandler argHandler = new ArgumentHandler(argv);
52
log = new Log(out, argHandler);
53
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
54
55
List acl = vmm.allConnectors();
56
if (acl.size() > 0) {
57
log.display("Number of all known JDI connectors: " + acl.size());
58
} else {
59
log.complain("FAILURE: no JDI connectors found!");
60
return 2;
61
}
62
63
Iterator aci = acl.iterator();
64
for (int i = 1; aci.hasNext(); i++) {
65
Connector c = (Connector) aci.next();
66
String cnm = c.name();
67
if (cnm == null) {
68
log.complain("FAILURE: connector name is null.");
69
log.complain(" Description: " + c.description());
70
log.complain(" Transport: " + c.transport().name());
71
return 2;
72
}
73
74
if (cnm.length() == 0) {
75
log.complain("FAILURE: connector with empty-name is found.");
76
log.complain(" Description: " + c.description());
77
log.complain(" Transport: " + c.transport().name());
78
return 2;
79
}
80
81
log.display("Next (" + i + ") connector's name is: " + cnm);
82
};
83
log.display("Test PASSED!");
84
return 0;
85
}
86
}
87
88