< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java

Print this page

  1 /*
  2  * Copyright (c) 2001, 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  */

122                     reply.resetPosition();
123 
124                     int interfaces = reply.getInt();
125                     log.display("  interfaces: " + interfaces);
126 
127                     if (interfaces != DECLARED_INTERFACES) {
128                         log.complain("Unexpected number of declared interfaces in the reply packet:" + interfaces
129                                     + " (expected: " + DECLARED_INTERFACES + ")");
130                         success = false;
131                     }
132 
133                     for (int i = 0; i < interfaces; i++ ) {
134 
135                         log.display("  interface #" + i);
136 
137                         long interfaceID = reply.getReferenceTypeID();
138                         log.display("    interfaceID: " + interfaceID);
139 
140                         if (interfaceID != interfaceIDs[i]) {
141                             log.complain("Unexpected interface ID for interface #" + i + " in the reply packet: " + interfaceID
142                                         + " (expected: " + interfaceIDs[i] + ")");
143                             success = false;
144                         }
145 
146                     }
147 
148                     if (! reply.isParsed()) {
149                         log.complain("Extra trailing bytes found in reply packet at: " + reply.currentPosition());
150                         success = false;
151                     } else {
152                         log.display("Reply packet parsed successfully");
153                     }
154 
155                     // end test of JDWP command
156 
157                 } catch (Exception e) {
158                     log.complain("Caught exception while testing JDWP command: " + e);
159                     success = false;
160                 } finally {
161                     log.display("Sending command: " + "quit");
162                     pipe.println("quit");

  1 /*
  2  * Copyright (c) 2001, 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  */

122                     reply.resetPosition();
123 
124                     int interfaces = reply.getInt();
125                     log.display("  interfaces: " + interfaces);
126 
127                     if (interfaces != DECLARED_INTERFACES) {
128                         log.complain("Unexpected number of declared interfaces in the reply packet:" + interfaces
129                                     + " (expected: " + DECLARED_INTERFACES + ")");
130                         success = false;
131                     }
132 
133                     for (int i = 0; i < interfaces; i++ ) {
134 
135                         log.display("  interface #" + i);
136 
137                         long interfaceID = reply.getReferenceTypeID();
138                         log.display("    interfaceID: " + interfaceID);
139 
140                         if (interfaceID != interfaceIDs[i]) {
141                             log.complain("Unexpected interface ID for interface #" + i + " in the reply packet: " + interfaceID
142                                          + " (expected: " + interfaceIDs[i] + ")");
143                             success = false;
144                         }
145 
146                     }
147 
148                     if (! reply.isParsed()) {
149                         log.complain("Extra trailing bytes found in reply packet at: " + reply.currentPosition());
150                         success = false;
151                     } else {
152                         log.display("Reply packet parsed successfully");
153                     }
154 
155                     // end test of JDWP command
156 
157                 } catch (Exception e) {
158                     log.complain("Caught exception while testing JDWP command: " + e);
159                     success = false;
160                 } finally {
161                     log.display("Sending command: " + "quit");
162                     pipe.println("quit");
< prev index next >