1 /*
2  * Copyright (c) 2018, 2020, 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 
25 /*
26  * @test
27  *
28  * @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid004.
29  * VM Testbase keywords: [quick, jpda, jdi]
30  * VM Testbase readme:
31  * DESCRIPTION:
32  *     The test for the implementation of an object of the type
33  *     Connector.Argument.
34  *    The test checks up that results of the method
35  *    Connector.Argument.isValid()
36  *    complies with its specification, that is,
37  *    "Returns: true if the value is valid to be used in setValue(String)"
38  *    in case when Argument implements IntegerArgument
39  *    and parameters are strings representing values min(), max(),
40  *    min()-1, min()+1 and max()+1.
41  *     The test works as follows:
42  *     - Virtual Machine Manager is invoked.
43  *     - First Connector.Argument which implement Connector.IntegerArgument
44  *     object is searched among Arguments of Connectors.
45  *     If no intArgument is found out
46  *     the test exits with the return value = 95 and a warning message.
47  *     - The follwing checks are made:
48  *         argument.isValid(
49  *         intArgurmnt.stringValueOf(
50  *         int.Argument.min()))
51  *           expexted result - true
52  *         if (intArgument.min() < intArgument.max())
53  *               argument.isValid(
54  *               intArgurmnt.stringValueOf(
55  *               int.Argument.min() + 1))
56  *           expected result - true
57  *         argument.isValid(
58  *         intArgurmnt.stringValueOf(
59  *         int.Argument.max())
60  *           expexted result - true
61  *         if (intArgument.min() > INTEGER.MIN_VALUE)
62  *               argument.isValid(
63  *               intArgurmnt.stringValueOf(
64  *               int.Argument.min() - 1)
65  *           expected result - false
66  *         if (intArgument.max() < INTEGER.MAX_VALUE)
67  *               argument.isValid(
68  *               intArgurmnt.stringValueOf(
69  *               int.Argument.max() + 1)
70  *           expected result - false
71  *     In case of unexpected result
72  *     the test produces the return value 97 and
73  *     a corresponding error message(s).
74  *     Otherwise, the test is passed and produces
75  *     the return value 95 and no message.
76  * COMMENTS:
77  *
78  * @library /vmTestbase
79  *          /test/lib
80  * @build nsk.jdi.Argument.isValid.isvalid004
81  * @run main/othervm
82  *      nsk.jdi.Argument.isValid.isvalid004
83  *      -verbose
84  *      -arch=${os.family}-${os.simpleArch}
85  *      -waittime=5
86  *      -debugee.vmkind=java
87  *      -transport.address=dynamic
88  *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
89  */
90 
91