diff options
| author | Michael Meskes <meskes@debian.org> | 2010-06-04 09:49:50 +0200 |
|---|---|---|
| committer | Michael Meskes <meskes@debian.org> | 2010-06-04 09:49:50 +0200 |
| commit | e13debb062071c46f2707d0d0e59c57675b49360 (patch) | |
| tree | 922f54068563b5cf3274bae8ba8122ce4b4ede1d /src/libs/xpcom18a4/java/tests/TestVBox.java | |
| parent | abd0051802e55207e88435a185ff8d6e6b8d17d5 (diff) | |
| download | virtualbox-upstream/3.2.2-dfsg.tar.gz | |
Imported Upstream version 3.2.2-dfsgupstream/3.2.2-dfsg
Diffstat (limited to 'src/libs/xpcom18a4/java/tests/TestVBox.java')
| -rw-r--r-- | src/libs/xpcom18a4/java/tests/TestVBox.java | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/src/libs/xpcom18a4/java/tests/TestVBox.java b/src/libs/xpcom18a4/java/tests/TestVBox.java deleted file mode 100644 index 064477a09..000000000 --- a/src/libs/xpcom18a4/java/tests/TestVBox.java +++ /dev/null @@ -1,107 +0,0 @@ -/* $Id:$ */ -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -import org.mozilla.interfaces.*; -import org.virtualbox.*; - -class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback -{ - public void onGuestPropertyChange(String machineId, String name, String value, String flags) - { - System.out.println("onGuestPropertyChange -- VM: " + machineId + ", " + name + "->" + value); - } - public void onSnapshotChange(String machineId, String snapshotId) - { - } - public void onSnapshotDeleted(String machineId, String snapshotId) - { - } - public void onSnapshotTaken(String machineId, String snapshotId) {} - public void onSessionStateChange(String machineId, long state) - { - System.out.println("onSessionStateChange -- VM: " + machineId + ", state: " + state); - } - public void onMachineRegistered(String machineId, boolean registered) {} - public void onMediumRegistered(String mediumId, long mediumType, boolean registered) {} - public void onExtraDataChange(String machineId, String key, String value) - { - System.out.println("onExtraDataChange -- VM: " + machineId + ": " + key+"->"+value); - } - public boolean onExtraDataCanChange(String machineId, String key, String value, String[] error) { return true; } - public void onMachineDataChange(String machineId) - {} - public void onMachineStateChange(String machineId, long state) - { - System.out.println("onMachineStateChange -- VM: " + machineId + ", state: " + state); - } -} - -public class TestVBox -{ - static void testCallbacks(VirtualBoxManager mgr, IVirtualBox vbox) - { - IVirtualBoxCallback cbs = new VBoxCallbacks(); - vbox.registerCallback(cbs); - for (int i=0; i<100; i++) - { - mgr.waitForEvents(500); - } - vbox.unregisterCallback(cbs); - } - - static void testEnumeration(VirtualBoxManager mgr, IVirtualBox vbox) - { - IMachine[] machs = vbox.getMachines(null); - for (IMachine m : machs) - { - System.out.println("VM name: " + m.getName() + ", RAM size: " + m.getMemorySize() + "MB"); - System.out.println(" HWVirt: " + m.getHWVirtExProperty(HWVirtExPropertyType.Enabled) - + ", Nested Paging: " + m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging) - + ", PAE: " + m.getCPUProperty(CPUPropertyType.PAE) ); - } - } - - static void testStart(VirtualBoxManager mgr, IVirtualBox vbox) - { - String m = vbox.getMachines(null)[0].getName(); - System.out.println("\nAttempting to start VM '" + m + "'"); - mgr.startVm(m, null, 7000); - } - - public static void main(String[] args) - { - VirtualBoxManager mgr = VirtualBoxManager.getInstance(null); - - System.out.println("\n--> initialized\n"); - - try - { - IVirtualBox vbox = mgr.getVBox(); - System.out.println("VirtualBox version: " + vbox.getVersion() + "\n"); - testEnumeration(mgr, vbox); - testCallbacks(mgr, vbox); - - System.out.println("done, press Enter..."); - int ch = System.in.read(); - } - catch (Throwable e) - { - e.printStackTrace(); - } - - mgr.cleanup(); - - System.out.println("\n--< done\n"); - } - -} |
