velir_virtualbox 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.yardopts +3 -0
- data/Gemfile +16 -0
- data/LICENSE +19 -0
- data/Rakefile +37 -0
- data/Readme.md +70 -0
- data/docs/GettingStarted.md +196 -0
- data/docs/WhatsNew.md +12 -0
- data/features/README.md +33 -0
- data/features/global.feature +19 -0
- data/features/global_extra_data.feature +27 -0
- data/features/step_definitions/abstract_model_steps.rb +39 -0
- data/features/step_definitions/extra_data_steps.rb +36 -0
- data/features/step_definitions/global_steps.rb +29 -0
- data/features/step_definitions/nat_engine_steps.rb +76 -0
- data/features/step_definitions/network_adapter_steps.rb +38 -0
- data/features/step_definitions/shared_folder_steps.rb +76 -0
- data/features/step_definitions/snapshot_steps.rb +74 -0
- data/features/step_definitions/storage_controller_steps.rb +16 -0
- data/features/step_definitions/virtualbox_steps.rb +17 -0
- data/features/step_definitions/vm_steps.rb +50 -0
- data/features/support/env.rb +61 -0
- data/features/support/helpers.rb +38 -0
- data/features/support/hooks.rb +30 -0
- data/features/support/ordered_hash.rb +49 -0
- data/features/support/vboxmanage.rb +191 -0
- data/features/version.feature +16 -0
- data/features/vm.feature +13 -0
- data/features/vm_bios.feature +29 -0
- data/features/vm_cpu.feature +29 -0
- data/features/vm_extra_data.feature +35 -0
- data/features/vm_hw_virt.feature +29 -0
- data/features/vm_nat_engine.feature +57 -0
- data/features/vm_network_adapters.feature +27 -0
- data/features/vm_shared_folders.feature +42 -0
- data/features/vm_snapshots.feature +29 -0
- data/features/vm_storage_controllers.feature +11 -0
- data/lib/virtualbox.rb +11 -0
- data/lib/virtualbox/abstract_model.rb +281 -0
- data/lib/virtualbox/abstract_model/attributable.rb +290 -0
- data/lib/virtualbox/abstract_model/dirty.rb +177 -0
- data/lib/virtualbox/abstract_model/interface_attributes.rb +98 -0
- data/lib/virtualbox/abstract_model/relatable.rb +332 -0
- data/lib/virtualbox/abstract_model/validatable.rb +167 -0
- data/lib/virtualbox/abstract_model/version_matcher.rb +35 -0
- data/lib/virtualbox/appliance.rb +62 -0
- data/lib/virtualbox/audio_adapter.rb +52 -0
- data/lib/virtualbox/bios.rb +50 -0
- data/lib/virtualbox/com.rb +23 -0
- data/lib/virtualbox/com/abstract_enum.rb +43 -0
- data/lib/virtualbox/com/abstract_implementer.rb +45 -0
- data/lib/virtualbox/com/abstract_interface.rb +167 -0
- data/lib/virtualbox/com/base_interface.rb +38 -0
- data/lib/virtualbox/com/ffi/interface.rb +150 -0
- data/lib/virtualbox/com/ffi/interfaces.rb +63 -0
- data/lib/virtualbox/com/ffi/util.rb +121 -0
- data/lib/virtualbox/com/ffi/vboxxpcomc.rb +31 -0
- data/lib/virtualbox/com/ffi_interface.rb +96 -0
- data/lib/virtualbox/com/implementer/base.rb +59 -0
- data/lib/virtualbox/com/implementer/ffi.rb +381 -0
- data/lib/virtualbox/com/implementer/mscom.rb +189 -0
- data/lib/virtualbox/com/implementer/nil.rb +10 -0
- data/lib/virtualbox/com/interface/3.1.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.1.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/guest_os_type.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/host.rb +42 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/machine.rb +105 -0
- data/lib/virtualbox/com/interface/3.1.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/medium.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.1.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/system_properties.rb +37 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_controller.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_server.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.2.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/3.2.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/machine.rb +118 -0
- data/lib/virtualbox/com/interface/3.2.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/medium.rb +51 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter.rb +34 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.2.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_server.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/appliance.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/cleanup_mode.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/4.0.x/event_source.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/fault_tolerance_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/4.0.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/hw_virt_ex_property_type.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/lock_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/machine.rb +132 -0
- data/lib/virtualbox/com/interface/4.0.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/medium.rb +53 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter.rb +35 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/progress.rb +64 -0
- data/lib/virtualbox/com/interface/4.0.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtualbox.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/vrde_server.rb +23 -0
- data/lib/virtualbox/com/mscom_interface.rb +44 -0
- data/lib/virtualbox/com/nil_interface.rb +7 -0
- data/lib/virtualbox/com/util.rb +32 -0
- data/lib/virtualbox/cpu.rb +61 -0
- data/lib/virtualbox/dhcp_server.rb +89 -0
- data/lib/virtualbox/dvd.rb +27 -0
- data/lib/virtualbox/exceptions.rb +39 -0
- data/lib/virtualbox/ext/byte_normalizer.rb +17 -0
- data/lib/virtualbox/ext/glob_loader.rb +35 -0
- data/lib/virtualbox/ext/logger.rb +38 -0
- data/lib/virtualbox/ext/platform.rb +31 -0
- data/lib/virtualbox/ext/subclass_listing.rb +24 -0
- data/lib/virtualbox/extra_data.rb +127 -0
- data/lib/virtualbox/forwarded_port.rb +222 -0
- data/lib/virtualbox/global.rb +96 -0
- data/lib/virtualbox/hard_drive.rb +246 -0
- data/lib/virtualbox/host.rb +71 -0
- data/lib/virtualbox/host_network_interface.rb +137 -0
- data/lib/virtualbox/hw_virtualization.rb +64 -0
- data/lib/virtualbox/lib.rb +84 -0
- data/lib/virtualbox/media.rb +20 -0
- data/lib/virtualbox/medium.rb +145 -0
- data/lib/virtualbox/medium_attachment.rb +61 -0
- data/lib/virtualbox/nat_engine.rb +71 -0
- data/lib/virtualbox/nat_forwarded_port.rb +171 -0
- data/lib/virtualbox/network_adapter.rb +166 -0
- data/lib/virtualbox/proxies/collection.rb +57 -0
- data/lib/virtualbox/shared_folder.rb +220 -0
- data/lib/virtualbox/snapshot.rb +185 -0
- data/lib/virtualbox/storage_controller.rb +160 -0
- data/lib/virtualbox/system_properties.rb +73 -0
- data/lib/virtualbox/usb_controller.rb +59 -0
- data/lib/virtualbox/usb_device_filter.rb +74 -0
- data/lib/virtualbox/version.rb +36 -0
- data/lib/virtualbox/virtual_system_description.rb +47 -0
- data/lib/virtualbox/vm.rb +649 -0
- data/lib/virtualbox/vrde_server.rb +57 -0
- data/test/test_helper.rb +18 -0
- data/test/virtualbox/abstract_model/attributable_test.rb +269 -0
- data/test/virtualbox/abstract_model/dirty_test.rb +83 -0
- data/test/virtualbox/abstract_model/interface_attributes_test.rb +194 -0
- data/test/virtualbox/abstract_model/relatable_test.rb +348 -0
- data/test/virtualbox/abstract_model/validatable_test.rb +308 -0
- data/test/virtualbox/abstract_model/version_matcher_test.rb +41 -0
- data/test/virtualbox/abstract_model_test.rb +462 -0
- data/test/virtualbox/appliance_test.rb +159 -0
- data/test/virtualbox/audio_adapter_test.rb +83 -0
- data/test/virtualbox/bios_test.rb +83 -0
- data/test/virtualbox/com/abstract_enum_test.rb +49 -0
- data/test/virtualbox/com/abstract_implementer_test.rb +40 -0
- data/test/virtualbox/com/abstract_interface_test.rb +140 -0
- data/test/virtualbox/com/ffi/interface_test.rb +249 -0
- data/test/virtualbox/com/ffi/util_test.rb +108 -0
- data/test/virtualbox/com/ffi_interface_test.rb +42 -0
- data/test/virtualbox/com/implementer/base_test.rb +38 -0
- data/test/virtualbox/com/implementer/ffi_test.rb +527 -0
- data/test/virtualbox/com/implementer/mscom_test.rb +247 -0
- data/test/virtualbox/com/mscom_interface_test.rb +17 -0
- data/test/virtualbox/com/util_test.rb +17 -0
- data/test/virtualbox/cpu_test.rb +103 -0
- data/test/virtualbox/dhcp_server_test.rb +165 -0
- data/test/virtualbox/dvd_test.rb +28 -0
- data/test/virtualbox/ext/byte_normalizer_test.rb +34 -0
- data/test/virtualbox/ext/platform_test.rb +50 -0
- data/test/virtualbox/ext/subclass_listing_test.rb +25 -0
- data/test/virtualbox/extra_data_test.rb +155 -0
- data/test/virtualbox/forwarded_port_test.rb +286 -0
- data/test/virtualbox/global_test.rb +46 -0
- data/test/virtualbox/hard_drive_test.rb +141 -0
- data/test/virtualbox/host_network_interface_test.rb +255 -0
- data/test/virtualbox/host_test.rb +94 -0
- data/test/virtualbox/hw_virtualization_test.rb +103 -0
- data/test/virtualbox/lib_test.rb +93 -0
- data/test/virtualbox/medium_attachment_test.rb +147 -0
- data/test/virtualbox/medium_test.rb +192 -0
- data/test/virtualbox/nat_engine_test.rb +106 -0
- data/test/virtualbox/nat_forwarded_port_test.rb +222 -0
- data/test/virtualbox/network_adapter_test.rb +191 -0
- data/test/virtualbox/proxies/collection_test.rb +102 -0
- data/test/virtualbox/shared_folder_test.rb +219 -0
- data/test/virtualbox/snapshot_test.rb +231 -0
- data/test/virtualbox/storage_controller_test.rb +197 -0
- data/test/virtualbox/system_properties_test.rb +87 -0
- data/test/virtualbox/usb_controller_test.rb +112 -0
- data/test/virtualbox/usb_device_filter_test.rb +93 -0
- data/test/virtualbox/version_test.rb +59 -0
- data/test/virtualbox/virtual_system_description_test.rb +61 -0
- data/test/virtualbox/vm_test.rb +633 -0
- data/test/virtualbox/vrde_server_test.rb +83 -0
- data/test/virtualbox_test.rb +11 -0
- data/virtualbox.gemspec +24 -0
- metadata +464 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
# Before everything, load virtualbox, of course
|
2
|
+
require 'spec'
|
3
|
+
require File.join(File.dirname(__FILE__), %W[.. .. lib virtualbox])
|
4
|
+
|
5
|
+
# Configuration settings/info
|
6
|
+
IntegrationInfo = {
|
7
|
+
:test_unsafe => !!ENV["TEST_UNSAFE"],
|
8
|
+
:vm_name => "test_vm"
|
9
|
+
}
|
10
|
+
|
11
|
+
# Mapping of VirtualBox::VM property keys to attributes in the
|
12
|
+
# `showvminfo` output.
|
13
|
+
VM_MAPPINGS = {
|
14
|
+
:uuid => "UUID",
|
15
|
+
:name => "name",
|
16
|
+
:os_type_id => "ostype",
|
17
|
+
:memory_size => "memory",
|
18
|
+
:vram_size => "vram",
|
19
|
+
:cpu_count => "cpus",
|
20
|
+
:accelerate_3d_enabled => "accelerate3d",
|
21
|
+
:accelerate_2d_video_enabled => "accelerate2dvideo",
|
22
|
+
:clipboard_mode => "clipboard",
|
23
|
+
:monitor_count => "monitorcount"
|
24
|
+
}
|
25
|
+
|
26
|
+
BIOS_MAPPINGS = {
|
27
|
+
:acpi_enabled => "acpi",
|
28
|
+
:io_apic_enabled => "ioapic"
|
29
|
+
}
|
30
|
+
|
31
|
+
HWVIRT_MAPPINGS = {
|
32
|
+
:enabled => "hwvirtex",
|
33
|
+
:exclusive => "hwvirtexexcl",
|
34
|
+
:nested_paging => "nestedpaging",
|
35
|
+
:vpid => "vtxvpid"
|
36
|
+
}
|
37
|
+
|
38
|
+
CPU_MAPPINGS = {
|
39
|
+
:pae => "pae",
|
40
|
+
:synthetic => "synthcpu"
|
41
|
+
}
|
42
|
+
|
43
|
+
STORAGE_MAPPINGS = {
|
44
|
+
:port_count => "portcount",
|
45
|
+
:controller_type => "type"
|
46
|
+
}
|
47
|
+
|
48
|
+
SHARED_FOLDER_MAPPINGS = {
|
49
|
+
:host_path => "path"
|
50
|
+
}
|
51
|
+
|
52
|
+
NETWORK_ADAPTER_MAPPINGS = {
|
53
|
+
:mac_address => "macaddress",
|
54
|
+
:cable_connected => "cableconnected"
|
55
|
+
}
|
56
|
+
|
57
|
+
FORWARDED_PORT_MAPPINGS = {
|
58
|
+
:protocol => "protocol",
|
59
|
+
:hostport => "hostport",
|
60
|
+
:guestport => "guestport"
|
61
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
module IntegrationHelpers
|
3
|
+
# Tests that given a mappings hash (see `VM_MAPPINGS` in env.rb),
|
4
|
+
# a model, and an output hash (string to string), that all the
|
5
|
+
# mappings from model match output.
|
6
|
+
def test_mappings(mappings, model, output)
|
7
|
+
mappings.each do |model_key, output_key|
|
8
|
+
value = model.send(model_key)
|
9
|
+
|
10
|
+
if [TrueClass, FalseClass].include?(value.class)
|
11
|
+
# Convert true/false to VirtualBox-style string boolean values
|
12
|
+
value = value ? "on" : "off"
|
13
|
+
end
|
14
|
+
|
15
|
+
output_value = output[output_key.to_sym] || output[output_key]
|
16
|
+
value, output_value = yield value, output_value if block_given?
|
17
|
+
value.to_s.should == output_value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Applies a function to every snapshot.
|
22
|
+
def snapshot_map(snapshots, &block)
|
23
|
+
applier = lambda do |snapshot|
|
24
|
+
return if !snapshot || snapshot.empty?
|
25
|
+
|
26
|
+
snapshot[:children].each do |child|
|
27
|
+
applier.call(child)
|
28
|
+
end
|
29
|
+
|
30
|
+
block.call(snapshot)
|
31
|
+
end
|
32
|
+
|
33
|
+
applier.call(snapshots)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
World(VirtualBox::IntegrationHelpers)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#------------------------------------------------------------
|
2
|
+
# Hooks
|
3
|
+
#------------------------------------------------------------
|
4
|
+
# Unsafe tags specify that a test modifies (writes or deletes)
|
5
|
+
# actual data in VirtualBox.
|
6
|
+
Around('@unsafe') do |scenario, block|
|
7
|
+
block.call if IntegrationInfo[:test_unsafe]
|
8
|
+
end
|
9
|
+
|
10
|
+
Around('@pending') do |scenario, block|
|
11
|
+
# Don't run the block
|
12
|
+
end
|
13
|
+
|
14
|
+
#------------------------------------------------------------
|
15
|
+
# Warning/Info messages about settings.
|
16
|
+
#------------------------------------------------------------
|
17
|
+
if !IntegrationInfo[:test_unsafe]
|
18
|
+
puts <<-MSG
|
19
|
+
========================================================================
|
20
|
+
|
21
|
+
For your own safety, unsafe tests (tests which modify actual VirtualBox
|
22
|
+
data), are disabled unless the environmental variable TEST_UNSAFE is
|
23
|
+
set. To enable unsafe tests, the easiest way is to do the following:
|
24
|
+
|
25
|
+
TEST_UNSAFE=yes rake test:integration
|
26
|
+
|
27
|
+
========================================================================
|
28
|
+
MSG
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# A super simple ordered hash implementation. This class probably
|
2
|
+
# isn't useful outside of these testing scripts, since only the bare
|
3
|
+
# minimum is implemented.
|
4
|
+
#
|
5
|
+
# The ordered hash is implemented by keeping the key/values in an
|
6
|
+
# array where each element is an array of format [key,value]. This
|
7
|
+
# forces the keys to be in the proper order, paired with their
|
8
|
+
# values.
|
9
|
+
class OrderedHash
|
10
|
+
include Enumerable
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@items = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def []=(key,value)
|
17
|
+
# Try to update it in the array if it exists
|
18
|
+
@items.each_with_index do |data, index|
|
19
|
+
return @items[index][1] = value if data[0] == key
|
20
|
+
end
|
21
|
+
|
22
|
+
# Otherwise just add it to the list
|
23
|
+
@items << [key, value]
|
24
|
+
end
|
25
|
+
|
26
|
+
def [](key)
|
27
|
+
@items.each do |k, v|
|
28
|
+
return v if k == key
|
29
|
+
end
|
30
|
+
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def each(&block)
|
35
|
+
@items.each(&block)
|
36
|
+
end
|
37
|
+
|
38
|
+
def empty?
|
39
|
+
@items.empty?
|
40
|
+
end
|
41
|
+
|
42
|
+
def has_key?(key)
|
43
|
+
@items.each do |k,v|
|
44
|
+
return true if k == key
|
45
|
+
end
|
46
|
+
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
class VBoxManage
|
2
|
+
class << self
|
3
|
+
def command(*args)
|
4
|
+
args = args.dup.flatten
|
5
|
+
args.unshift("-q")
|
6
|
+
"VBoxManage #{args.join(" ")}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute(*args)
|
10
|
+
cmd = command(*args)
|
11
|
+
result = `#{cmd}`.chomp
|
12
|
+
raise Exception.new("Failed command: #{cmd}") if $?.exitstatus != 0
|
13
|
+
result
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gets the extra data for a VM of the given ID and returns it in
|
17
|
+
# hash format.
|
18
|
+
def extra_data(name)
|
19
|
+
output = execute("getextradata", name, "enumerate")
|
20
|
+
|
21
|
+
output.split("\n").inject({}) do |acc, line|
|
22
|
+
acc[$1.to_s] = $2.to_s if line =~ /^Key: (.+?), Value: (.+?)$/
|
23
|
+
acc
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Gets the info for a VM and returns it in hash format.
|
28
|
+
def vm_info(name)
|
29
|
+
output = begin
|
30
|
+
execute("showvminfo", name, "--machinereadable")
|
31
|
+
rescue Exception
|
32
|
+
""
|
33
|
+
end
|
34
|
+
|
35
|
+
output.split("\n").inject(OrderedHash.new) do |acc, line|
|
36
|
+
if line =~ /^"?(.+?)"?=(.+?)$/
|
37
|
+
key = $1.to_s
|
38
|
+
value = $2.to_s
|
39
|
+
value = $1.to_s if value =~ /^"(.*?)"$/
|
40
|
+
acc[key] = value
|
41
|
+
end
|
42
|
+
|
43
|
+
acc
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Parses the storage controllers out of VM info output and returns
|
48
|
+
# it in a programmer-friendly hash.
|
49
|
+
def storage_controllers(info)
|
50
|
+
raw = info.inject({}) do |acc, data|
|
51
|
+
k,v = data
|
52
|
+
|
53
|
+
if k =~ /^storagecontroller(.+?)(\d+)$/
|
54
|
+
subkey = $2.to_s
|
55
|
+
acc[subkey] ||= {}
|
56
|
+
acc[subkey][$1.to_s.to_sym] = v
|
57
|
+
end
|
58
|
+
|
59
|
+
acc
|
60
|
+
end
|
61
|
+
|
62
|
+
raw.inject({}) do |acc, data|
|
63
|
+
k,v = data
|
64
|
+
acc[v.delete(:name)] = v
|
65
|
+
acc
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Parses the shared folders out of the VM info output and returns
|
70
|
+
# it in a programmer-friendly hash.
|
71
|
+
def shared_folders(info)
|
72
|
+
raw = info.inject({}) do |acc, data|
|
73
|
+
k,v = data
|
74
|
+
|
75
|
+
if k =~ /^SharedFolder(.+?)MachineMapping(\d+)$/
|
76
|
+
subkey = $2.to_s
|
77
|
+
acc[subkey] ||= {}
|
78
|
+
acc[subkey][$1.to_s.downcase.to_sym] = v
|
79
|
+
end
|
80
|
+
|
81
|
+
acc
|
82
|
+
end
|
83
|
+
|
84
|
+
raw.inject({}) do |acc, data|
|
85
|
+
k,v = data
|
86
|
+
acc[v.delete(:name)] = v
|
87
|
+
acc
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Parses the network adapters out of the VM info output and
|
92
|
+
# returns it in a hash.
|
93
|
+
def network_adapters(info)
|
94
|
+
valid_keys = %W[natnet macaddress cableconnected hostonlyadapter]
|
95
|
+
|
96
|
+
info.inject({}) do |acc, data|
|
97
|
+
k,v = data
|
98
|
+
if k =~ /^nic(\d+)$/
|
99
|
+
acc[$1.to_i] ||= {}
|
100
|
+
acc[$1.to_i][:type] = v
|
101
|
+
elsif k=~ /^(.+?)(\d+)$/ && valid_keys.include?($1.to_s)
|
102
|
+
acc[$2.to_i] ||= {}
|
103
|
+
acc[$2.to_i][$1.to_s.to_sym] = v
|
104
|
+
end
|
105
|
+
|
106
|
+
acc
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Parses the forwarded ports out of the VM info output and returns
|
111
|
+
# it in a hash.
|
112
|
+
def forwarded_ports(info, slot)
|
113
|
+
seen = false
|
114
|
+
info.inject({}) do |acc, data|
|
115
|
+
k,v = data
|
116
|
+
|
117
|
+
seen = true if k == "nic#{slot}"
|
118
|
+
if seen && k =~ /^Forwarding\((\d+)\)$/
|
119
|
+
keys = [:name, :protocol, :hostip, :hostport, :guestip, :guestport]
|
120
|
+
v = v.split(",")
|
121
|
+
|
122
|
+
temp = {}
|
123
|
+
keys.each_with_index do |key, i|
|
124
|
+
temp[key] = v[i]
|
125
|
+
end
|
126
|
+
|
127
|
+
acc[temp.delete(:name)] = temp
|
128
|
+
end
|
129
|
+
|
130
|
+
acc
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Parses the snapshots out of the VM info output and returns it in
|
135
|
+
# a hash.
|
136
|
+
def snapshots(info)
|
137
|
+
info.inject({}) do |acc, data|
|
138
|
+
k,v = data
|
139
|
+
|
140
|
+
if k =~ /^Snapshot(.+?)(-(.+?))?$/
|
141
|
+
current = { $1.to_s.downcase.to_sym => v }
|
142
|
+
|
143
|
+
if $3
|
144
|
+
# This is a child snapshot
|
145
|
+
keys = $3.to_s.split("-").map do |key|
|
146
|
+
key.to_i - 1
|
147
|
+
end
|
148
|
+
final = keys.pop
|
149
|
+
|
150
|
+
location = acc
|
151
|
+
keys.each { |index| location = location[:children][index.to_i] }
|
152
|
+
|
153
|
+
parent = location
|
154
|
+
location = location[:children]
|
155
|
+
location[final] ||= {}
|
156
|
+
location[final].merge!(current)
|
157
|
+
location[final][:parent] = parent
|
158
|
+
location[final][:children] ||= []
|
159
|
+
else
|
160
|
+
acc ||= {}
|
161
|
+
acc.merge!(current)
|
162
|
+
acc[:children] ||= []
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
acc
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Gets the current snapshot.
|
171
|
+
def current_snapshot(info)
|
172
|
+
seen = false
|
173
|
+
uuid = nil
|
174
|
+
VBoxManage.execute("showvminfo", info["UUID"]).split("\n").each do |line|
|
175
|
+
seen = true if line =~ /^Snapshots:/
|
176
|
+
uuid = $2.to_s if seen && line =~ /Name:\s+(.+?)\s+\(UUID:\s+(.+?)\)\s+\*/
|
177
|
+
end
|
178
|
+
|
179
|
+
# The recursive sub-method which finds a snapshot by UUID
|
180
|
+
finder = lambda do |snapshot|
|
181
|
+
return snapshot if snapshot[:uuid] == uuid
|
182
|
+
|
183
|
+
snapshot[:children].find do |child|
|
184
|
+
finder.call(child)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
finder.call(snapshots(info))
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: VirtualBox version information
|
2
|
+
As a virtualbox library user
|
3
|
+
I want to access information about the installed version
|
4
|
+
In order to determine if I support this version of VirtualBox
|
5
|
+
|
6
|
+
Scenario: Reading the version
|
7
|
+
When I try to read the virtualbox "version"
|
8
|
+
Then the result should match version output
|
9
|
+
|
10
|
+
Scenario: Reading the revision
|
11
|
+
When I try to read the virtualbox "revision"
|
12
|
+
Then the result should match version output
|
13
|
+
|
14
|
+
Scenario: Checking if VirtualBox supported
|
15
|
+
When I try to read the virtualbox "supported?"
|
16
|
+
Then the result should match version output
|
data/features/vm.feature
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Virtual Machine
|
2
|
+
As a virtualbox library user
|
3
|
+
I want to access information about specific virtual machines
|
4
|
+
In order to get information about VMs in VirtualBox
|
5
|
+
|
6
|
+
Scenario: Finding a non-existent VM
|
7
|
+
When I find a VM identified by "this_should_never_exist1234"
|
8
|
+
Then the VM should not exist
|
9
|
+
|
10
|
+
Scenario: Finding a VM
|
11
|
+
When I find a VM identified by "test_vm_A"
|
12
|
+
Then the VM should exist
|
13
|
+
And the "VM" properties should match
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Virtual Machine BIOS Settings
|
2
|
+
As a virtualbox library user
|
3
|
+
I want to read and update VM BIOS
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I find a VM identified by "test_vm_A"
|
7
|
+
And I set the VM properties:
|
8
|
+
| name | value |
|
9
|
+
| acpi | off |
|
10
|
+
| ioapic | off |
|
11
|
+
And I reload the VM
|
12
|
+
And the "bios" relationship
|
13
|
+
|
14
|
+
Scenario: Reading BIOS
|
15
|
+
Then the "BIOS" properties should match
|
16
|
+
|
17
|
+
@unsafe
|
18
|
+
Scenario: Updating the BIOS
|
19
|
+
When I set the relationship property "acpi_enabled" to "true"
|
20
|
+
And I save the relationship
|
21
|
+
And I reload the VM info
|
22
|
+
Then the "BIOS" properties should match
|
23
|
+
|
24
|
+
@unsafe
|
25
|
+
Scenario: Updating the BIOS via the VM
|
26
|
+
When I set the relationship property "io_apic_enabled" to "true"
|
27
|
+
And I save the model
|
28
|
+
And I reload the VM info
|
29
|
+
Then the "BIOS" properties should match
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Virtual Machine CPU Settings
|
2
|
+
As a virtualbox library user
|
3
|
+
I want to read and update VM CPU settings
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I find a VM identified by "test_vm_A"
|
7
|
+
And I set the VM properties:
|
8
|
+
| name | value |
|
9
|
+
| pae | off |
|
10
|
+
| synthcpu | off |
|
11
|
+
And I reload the VM
|
12
|
+
And the "cpu" relationship
|
13
|
+
|
14
|
+
Scenario: Reading CPU settings
|
15
|
+
Then the "CPU" properties should match
|
16
|
+
|
17
|
+
@unsafe
|
18
|
+
Scenario: Updating the CPU settings
|
19
|
+
When I set the relationship property "pae" to "true"
|
20
|
+
And I save the relationship
|
21
|
+
And I reload the VM info
|
22
|
+
Then the "CPU" properties should match
|
23
|
+
|
24
|
+
@unsafe
|
25
|
+
Scenario: Updating the CPU settings via the VM
|
26
|
+
When I set the relationship property "synthetic" to "true"
|
27
|
+
And I save the model
|
28
|
+
And I reload the VM info
|
29
|
+
Then the "CPU" properties should match
|