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,41 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class VersionMatcherTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@module = VirtualBox::AbstractModel::VersionMatcher
|
6
|
+
@klass = Class.new
|
7
|
+
@klass.send(:extend, @module)
|
8
|
+
end
|
9
|
+
|
10
|
+
context "asserting version matches" do
|
11
|
+
should "raise an exception if versions do not match" do
|
12
|
+
assert_raises(VirtualBox::Exceptions::UnsupportedVersionException) {
|
13
|
+
@klass.assert_version_match("3.1", "3.2.4")
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
should "not raise an exception if versions do match" do
|
18
|
+
assert_nothing_raised {
|
19
|
+
@klass.assert_version_match("3.0", "3.0.14")
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "version matching" do
|
25
|
+
should "return true if versions match" do
|
26
|
+
assert @klass.version_match?("3.2", "3.2.4")
|
27
|
+
assert !@klass.version_match?("3.1", "3.2.4")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "splitting version" do
|
32
|
+
should "split into a max of two parts by period" do
|
33
|
+
assert_equal %W[3 2], @klass.split_version("3.2.0")
|
34
|
+
assert_equal %W[3 1], @klass.split_version("3.1.1.1.1")
|
35
|
+
end
|
36
|
+
|
37
|
+
should "return an empty array if it can't split" do
|
38
|
+
assert_equal [], @klass.split_version(nil)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,462 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class AbstractModelTest < Test::Unit::TestCase
|
4
|
+
class Foo
|
5
|
+
def self.set_relationship(caller, old_value, new_value)
|
6
|
+
new_value
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.validate_relationship(caller, data)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Bar; end
|
14
|
+
|
15
|
+
class FakeModel < VirtualBox::AbstractModel
|
16
|
+
attribute :foo, :property => false
|
17
|
+
attribute :bar
|
18
|
+
relationship :foos, Foo
|
19
|
+
relationship :bars, Bar, :dependent => :destroy
|
20
|
+
end
|
21
|
+
|
22
|
+
context "reloading" do
|
23
|
+
context "with a single class" do
|
24
|
+
setup do
|
25
|
+
@model = FakeModel.new
|
26
|
+
end
|
27
|
+
|
28
|
+
teardown do
|
29
|
+
FakeModel.reloaded!
|
30
|
+
end
|
31
|
+
|
32
|
+
should "not want to be reloaded initially" do
|
33
|
+
assert !FakeModel.reload?
|
34
|
+
end
|
35
|
+
|
36
|
+
should "want to be reloaded once signaled by the class method" do
|
37
|
+
FakeModel.reload!
|
38
|
+
assert FakeModel.reload?
|
39
|
+
end
|
40
|
+
|
41
|
+
should "want to be reloaded once signaled by the instance method" do
|
42
|
+
@model.reload!
|
43
|
+
assert FakeModel.reload?
|
44
|
+
end
|
45
|
+
|
46
|
+
should "not want to be reloaded once reloaded! is called" do
|
47
|
+
@model.reload!
|
48
|
+
assert FakeModel.reload?
|
49
|
+
FakeModel.reloaded!
|
50
|
+
assert !FakeModel.reload?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "with inheritance" do
|
55
|
+
class SubModel < FakeModel
|
56
|
+
end
|
57
|
+
|
58
|
+
setup do
|
59
|
+
@lazy = FakeModel.new
|
60
|
+
@sub = SubModel.new
|
61
|
+
end
|
62
|
+
|
63
|
+
should "not interfere with each others reload flags" do
|
64
|
+
@lazy.reload!
|
65
|
+
assert !SubModel.reload?
|
66
|
+
assert FakeModel.reload?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "errors for relationship default implementation" do
|
72
|
+
setup do
|
73
|
+
@klass = FakeModel
|
74
|
+
end
|
75
|
+
|
76
|
+
should "return the errors on the item" do
|
77
|
+
errors = mock("errors")
|
78
|
+
item = mock("item")
|
79
|
+
item.stubs(:errors).returns(errors)
|
80
|
+
assert_equal errors, @klass.errors_for_relationship(nil, item)
|
81
|
+
end
|
82
|
+
|
83
|
+
should "return nil if the item doesn't respond to errors" do
|
84
|
+
assert_nil @klass.errors_for_relationship(nil, 7)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "lazy attributes and relationships" do
|
89
|
+
class LazyModel < VirtualBox::AbstractModel
|
90
|
+
attribute :foo, :lazy => true
|
91
|
+
attribute :bar
|
92
|
+
relationship :foos, AbstractModelTest::Foo, :lazy => true
|
93
|
+
relationship :bars, AbstractModelTest::Bar, :lazy => true
|
94
|
+
end
|
95
|
+
|
96
|
+
setup do
|
97
|
+
@model = LazyModel.new
|
98
|
+
end
|
99
|
+
|
100
|
+
should "return false on lazy_attribute? for all attributes if new" do
|
101
|
+
assert !@model.lazy_attribute?(:foo)
|
102
|
+
assert !@model.lazy_relationship?(:foos)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "inspecting" do
|
107
|
+
setup do
|
108
|
+
@model = FakeModel.new
|
109
|
+
end
|
110
|
+
|
111
|
+
should "generate the proper inspect string" do
|
112
|
+
assert_equal "#<AbstractModelTest::FakeModel :bar=nil, :bars=..., :foo=nil, :foos=...>", @model.inspect
|
113
|
+
end
|
114
|
+
|
115
|
+
should "turn attributes which are AbstractModels into classes" do
|
116
|
+
@model.foo = @model.dup
|
117
|
+
assert_equal "#<AbstractModelTest::FakeModel :bar=nil, :bars=..., :foo=#<AbstractModelTest::FakeModel>, :foos=...>", @model.inspect
|
118
|
+
end
|
119
|
+
|
120
|
+
should "turn attributes which are AbstractInterfaces into classes" do
|
121
|
+
@model.foo = VirtualBox::COM::Util.versioned_interface(:VirtualBox).new(VirtualBox::COM::Implementer::Nil, nil)
|
122
|
+
assert_equal "#<AbstractModelTest::FakeModel :bar=nil, :bars=..., :foo=#<VirtualBox::COM::Interface::Version_3_2_X::VirtualBox>, :foos=...>", @model.inspect
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context "validation" do
|
127
|
+
setup do
|
128
|
+
@model = FakeModel.new
|
129
|
+
end
|
130
|
+
|
131
|
+
should "clear all previous errors" do
|
132
|
+
@model.expects(:clear_errors).once
|
133
|
+
@model.validate
|
134
|
+
end
|
135
|
+
|
136
|
+
should "call validate_relationship on each relationship class" do
|
137
|
+
Foo.expects(:validate_relationship).once.with(@model, nil)
|
138
|
+
@model.validate
|
139
|
+
end
|
140
|
+
|
141
|
+
should "forward arguments to validate_relationship" do
|
142
|
+
Foo.expects(:validate_relationship).once.with(@model, nil, "HELLO")
|
143
|
+
@model.validate("HELLO")
|
144
|
+
end
|
145
|
+
|
146
|
+
should "succeed if all relationships succeeded" do
|
147
|
+
Foo.expects(:validate_relationship).returns(true)
|
148
|
+
assert @model.validate
|
149
|
+
end
|
150
|
+
|
151
|
+
should "fail if one relationship failed to validate" do
|
152
|
+
Foo.expects(:validate_relationship).returns(true)
|
153
|
+
Bar.expects(:validate_relationship).returns(false)
|
154
|
+
assert !@model.validate
|
155
|
+
end
|
156
|
+
|
157
|
+
context "errors" do
|
158
|
+
should "return the errors of the relationships, as well as the model itself" do
|
159
|
+
@model.foo = nil
|
160
|
+
assert !@model.validate
|
161
|
+
|
162
|
+
@model.validates_presence_of(:foo)
|
163
|
+
Foo.expects(:errors_for_relationship).with(@model, nil).returns("BAD")
|
164
|
+
errors = @model.errors
|
165
|
+
assert errors.has_key?(:foos)
|
166
|
+
assert_equal "BAD", errors[:foos]
|
167
|
+
assert errors.has_key?(:foo)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
context "new/existing records" do
|
173
|
+
setup do
|
174
|
+
@model = FakeModel.new
|
175
|
+
end
|
176
|
+
|
177
|
+
should "be a new record by default" do
|
178
|
+
assert @model.new_record?
|
179
|
+
end
|
180
|
+
|
181
|
+
should "not be a new record if populate_attributes is called" do
|
182
|
+
@model.populate_attributes({})
|
183
|
+
assert !@model.new_record?
|
184
|
+
end
|
185
|
+
|
186
|
+
should "not be a new record after saving" do
|
187
|
+
assert @model.new_record?
|
188
|
+
@model.save
|
189
|
+
assert !@model.new_record?
|
190
|
+
end
|
191
|
+
|
192
|
+
should "become a new record again if new_record! is called" do
|
193
|
+
assert @model.new_record?
|
194
|
+
@model.save
|
195
|
+
assert !@model.new_record?
|
196
|
+
@model.new_record!
|
197
|
+
assert @model.new_record?
|
198
|
+
end
|
199
|
+
|
200
|
+
should "become an existing record if existing_record! is called" do
|
201
|
+
assert @model.new_record?
|
202
|
+
@model.existing_record!
|
203
|
+
assert !@model.new_record?
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "parent machine" do
|
208
|
+
setup do
|
209
|
+
# Create a subclass of VM and no-op the initialize so it doesn't
|
210
|
+
# try to populate VM attributes or relationships
|
211
|
+
@root = Class.new(VirtualBox::VM)
|
212
|
+
@root.class_eval("def initialize; end")
|
213
|
+
@root = @root.new
|
214
|
+
|
215
|
+
@leaf = @root
|
216
|
+
3.times do |i|
|
217
|
+
child = Class.new(VirtualBox::AbstractModel)
|
218
|
+
child.attribute(:parent, :readonly => true, :property => false)
|
219
|
+
child = child.new
|
220
|
+
child.write_attribute(:parent, @leaf)
|
221
|
+
@leaf = child
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
should "get the parent" do
|
226
|
+
# Sanity test
|
227
|
+
assert_equal @root, @leaf.parent.parent.parent
|
228
|
+
assert @root.is_a?(VirtualBox::VM)
|
229
|
+
|
230
|
+
# Actual test
|
231
|
+
assert_equal @root, @leaf.parent_machine
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context "subclasses" do
|
236
|
+
class FakeTwoModel < FakeModel
|
237
|
+
attribute :baz
|
238
|
+
end
|
239
|
+
|
240
|
+
setup do
|
241
|
+
@model = FakeTwoModel.new
|
242
|
+
@model.populate_attributes({
|
243
|
+
:foo => "foo",
|
244
|
+
:bar => "bar",
|
245
|
+
:baz => "baz"
|
246
|
+
})
|
247
|
+
end
|
248
|
+
|
249
|
+
should "have access to parents attributes" do
|
250
|
+
assert_nothing_raised do
|
251
|
+
assert_equal "foo", @model.foo
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
context "destroying" do
|
257
|
+
setup do
|
258
|
+
@model = FakeModel.new
|
259
|
+
end
|
260
|
+
|
261
|
+
should "call destroy_relationship only for dependent relationships" do
|
262
|
+
Foo.expects(:destroy_relationship).never
|
263
|
+
Bar.expects(:destroy_relationship).once
|
264
|
+
|
265
|
+
@model.destroy
|
266
|
+
end
|
267
|
+
|
268
|
+
should "forward any arguments to the destroy method" do
|
269
|
+
Bar.expects(:destroy_relationship).with(@model, anything, "HELLO").once
|
270
|
+
@model.destroy("HELLO")
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context "saving" do
|
275
|
+
setup do
|
276
|
+
@model = FakeModel.new
|
277
|
+
@model.populate_attributes({
|
278
|
+
:foo => "foo",
|
279
|
+
:bar => "bar"
|
280
|
+
})
|
281
|
+
end
|
282
|
+
|
283
|
+
should "call save_attribute for only attributes which have changed" do
|
284
|
+
@model.foo = "foo2"
|
285
|
+
assert @model.foo_changed?
|
286
|
+
assert !@model.bar_changed?
|
287
|
+
@model.expects(:save_attribute).with(:foo, "foo2").once
|
288
|
+
@model.save
|
289
|
+
end
|
290
|
+
|
291
|
+
should "clear dirty state once saved" do
|
292
|
+
@model.foo = "foo2"
|
293
|
+
assert @model.foo_changed?
|
294
|
+
@model.save
|
295
|
+
assert !@model.foo_changed?
|
296
|
+
end
|
297
|
+
|
298
|
+
should "forward parameters through" do
|
299
|
+
@model.expects(:save_attribute).with(:foo, "foo2", "YES").once
|
300
|
+
Foo.expects(:save_relationship).with(@model, anything, "YES").once
|
301
|
+
|
302
|
+
@model.foo = "foo2"
|
303
|
+
@model.save("YES")
|
304
|
+
end
|
305
|
+
|
306
|
+
should "return true if succeeds" do
|
307
|
+
assert @model.save
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
context "save!" do
|
312
|
+
setup do
|
313
|
+
@model = FakeModel.new
|
314
|
+
end
|
315
|
+
|
316
|
+
should "raise an exception if save failed" do
|
317
|
+
args = %W[foo bar baz]
|
318
|
+
@model.expects(:save).with(*args).returns(false)
|
319
|
+
assert_raises(VirtualBox::Exceptions::ValidationFailedException) {
|
320
|
+
@model.save!(*args)
|
321
|
+
}
|
322
|
+
end
|
323
|
+
|
324
|
+
should "not raise an exception if save succeeds" do
|
325
|
+
@model.expects(:save).returns(true)
|
326
|
+
assert_nothing_raised { @model.save! }
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
context "populating relationships and attributes" do
|
331
|
+
setup do
|
332
|
+
@model = FakeModel.new
|
333
|
+
end
|
334
|
+
|
335
|
+
context "populating attributes" do
|
336
|
+
should "populate relationships at the same time as attributes" do
|
337
|
+
Foo.expects(:populate_relationship).once
|
338
|
+
@model.populate_attributes({})
|
339
|
+
end
|
340
|
+
|
341
|
+
should "not populate relationships if :ignore_relationships is true" do
|
342
|
+
Foo.expects(:populate_relationship).never
|
343
|
+
@model.populate_attributes({}, :ignore_relationships => true)
|
344
|
+
end
|
345
|
+
|
346
|
+
should "cause the model to become an existing record" do
|
347
|
+
assert @model.new_record?
|
348
|
+
@model.populate_attributes({})
|
349
|
+
assert !@model.new_record?
|
350
|
+
end
|
351
|
+
|
352
|
+
should "not cause dirtiness" do
|
353
|
+
assert_nil @model.foo
|
354
|
+
@model.populate_attributes({ :foo => "foo" })
|
355
|
+
assert_equal "foo", @model.foo
|
356
|
+
assert !@model.changed?
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
context "populating relationships" do
|
361
|
+
should "cause the model to become an existing record" do
|
362
|
+
assert @model.new_record?
|
363
|
+
@model.populate_relationships({})
|
364
|
+
assert !@model.new_record?
|
365
|
+
end
|
366
|
+
|
367
|
+
should "not cause dirtiness" do
|
368
|
+
# TODO: This test doesn't do much right now. We need to actually compare
|
369
|
+
# the relationship values for dirtiness.
|
370
|
+
@model.populate_relationships({ :foo => "foo" })
|
371
|
+
assert !@model.changed?
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
context "populating a single relationship" do
|
376
|
+
should "cause the model to become an existing record" do
|
377
|
+
assert @model.new_record?
|
378
|
+
@model.populate_relationship(:foos, {})
|
379
|
+
assert !@model.new_record?
|
380
|
+
end
|
381
|
+
|
382
|
+
should "not cause dirtiness" do
|
383
|
+
@model.populate_relationship(:foos, {})
|
384
|
+
assert !@model.changed?
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
context "integrating interface attributes" do
|
390
|
+
setup do
|
391
|
+
@model = FakeModel.new
|
392
|
+
end
|
393
|
+
|
394
|
+
should "clear the dirty state of an attribute after saving" do
|
395
|
+
key = :foo
|
396
|
+
interface = :bar
|
397
|
+
@model.expects(:clear_dirty!).with(key).once
|
398
|
+
@model.save_interface_attribute(key, interface)
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
context "integrating relatable" do
|
403
|
+
setup do
|
404
|
+
@model = FakeModel.new
|
405
|
+
end
|
406
|
+
|
407
|
+
context "saving all changed interface attributes" do
|
408
|
+
setup do
|
409
|
+
@interface = mock("interface")
|
410
|
+
@changes = [[:a, []], [:b, []], [:c, []]]
|
411
|
+
@model.stubs(:changes).returns(@changes)
|
412
|
+
end
|
413
|
+
|
414
|
+
should "save each" do
|
415
|
+
@model.changes.each do |key, options|
|
416
|
+
@model.expects(:save_interface_attribute).with(key, @interface)
|
417
|
+
end
|
418
|
+
|
419
|
+
@model.save_changed_interface_attributes(@interface)
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
context "with dirty" do
|
424
|
+
should "set dirty state when a relationship is set" do
|
425
|
+
assert !@model.changed?
|
426
|
+
@model.foos = "foo"
|
427
|
+
assert @model.changed?
|
428
|
+
end
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
context "integrating attributable and dirty" do
|
433
|
+
setup do
|
434
|
+
@model = FakeModel.new
|
435
|
+
end
|
436
|
+
|
437
|
+
should "not affect dirtiness with populate_attributes" do
|
438
|
+
assert !@model.changed?
|
439
|
+
@model.populate_attributes({
|
440
|
+
:foo => "foo2"
|
441
|
+
})
|
442
|
+
|
443
|
+
assert !@model.changed?
|
444
|
+
assert_equal "foo2", @model.foo
|
445
|
+
end
|
446
|
+
|
447
|
+
should "mark dirtiness on write_attribute" do
|
448
|
+
assert !@model.changed?
|
449
|
+
@model.write_attribute(:foo, "foo2")
|
450
|
+
assert @model.changed?
|
451
|
+
assert @model.foo_changed?
|
452
|
+
assert_equal "foo2", @model.foo
|
453
|
+
end
|
454
|
+
|
455
|
+
should "not mark dirtiness on write_attribute if the attribute is lazy and not yet loaded" do
|
456
|
+
@model.expects(:lazy_attribute?).with(:foo).returns(true)
|
457
|
+
@model.expects(:loaded_attribute?).with(:foo).returns(false)
|
458
|
+
@model.expects(:set_dirty!).never
|
459
|
+
@model.write_attribute(:foo, "foo2")
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|