equal
deleted
inserted
replaced
36 /* |
36 /* |
37 * @test |
37 * @test |
38 * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757 |
38 * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757 |
39 * @summary Basic unit tests for the VM attach mechanism. |
39 * @summary Basic unit tests for the VM attach mechanism. |
40 * @library /lib/testlibrary |
40 * @library /lib/testlibrary |
41 * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy |
41 * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy RunnerUtil |
42 * @run main BasicTests |
42 * @run main BasicTests |
43 * |
43 * |
44 * This test will perform a number of basic attach tests. |
44 * This test will perform a number of basic attach tests. |
45 */ |
45 */ |
46 public class BasicTests { |
46 public class BasicTests { |
236 System.out.println(" - Connected to RedefineAgent."); |
236 System.out.println(" - Connected to RedefineAgent."); |
237 |
237 |
238 // Test 6 - list method should list the target VM |
238 // Test 6 - list method should list the target VM |
239 System.out.println(" - Test: VirtualMachine.list"); |
239 System.out.println(" - Test: VirtualMachine.list"); |
240 List<VirtualMachineDescriptor> l = VirtualMachine.list(); |
240 List<VirtualMachineDescriptor> l = VirtualMachine.list(); |
241 if (!l.isEmpty()) { |
241 boolean found = false; |
242 boolean found = false; |
242 for (VirtualMachineDescriptor vmd: l) { |
243 for (VirtualMachineDescriptor vmd: l) { |
243 if (vmd.id().equals(pid)) { |
244 if (vmd.id().equals(pid)) { |
244 found = true; |
245 found = true; |
245 break; |
246 break; |
|
247 } |
|
248 } |
246 } |
249 if (found) { |
247 } |
250 System.out.println(" - " + pid + " found."); |
248 if (found) { |
251 } else { |
249 System.out.println(" - " + pid + " found."); |
252 throw new RuntimeException(pid + " not found in VM list"); |
250 } else { |
253 } |
251 throw new RuntimeException(pid + " not found in VM list"); |
254 } |
252 } |
255 |
253 |
256 // test 7 - basic hashCode/equals tests |
254 // test 7 - basic hashCode/equals tests |
257 System.out.println(" - Test: hashCode/equals"); |
255 System.out.println(" - Test: hashCode/equals"); |
258 |
256 |