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,106 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class NATEngineTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::NATEngine
|
6
|
+
@interface = mock("interface")
|
7
|
+
@parent = mock("parent")
|
8
|
+
end
|
9
|
+
|
10
|
+
context "initializing" do
|
11
|
+
should "load attributes from the machine" do
|
12
|
+
@klass.any_instance.expects(:initialize_attributes).with(@parent, @interface).once
|
13
|
+
@klass.new(@parent, @interface)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "initializing attributes" do
|
18
|
+
setup do
|
19
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
20
|
+
@klass.any_instance.stubs(:populate_relationships)
|
21
|
+
|
22
|
+
@instance = @klass.new(@parent, @interface)
|
23
|
+
end
|
24
|
+
|
25
|
+
should "load interface attribtues" do
|
26
|
+
@klass.any_instance.expects(:load_interface_attributes).with(@interface).once
|
27
|
+
@klass.new(@parent, @interface)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "setup the parent" do
|
31
|
+
assert_equal @parent, @instance.parent
|
32
|
+
end
|
33
|
+
|
34
|
+
should "setup the interface" do
|
35
|
+
assert_equal @interface, @instance.interface
|
36
|
+
end
|
37
|
+
|
38
|
+
should "not be dirty" do
|
39
|
+
assert !@instance.changed?
|
40
|
+
end
|
41
|
+
|
42
|
+
should "be existing record" do
|
43
|
+
assert !@instance.new_record?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "class methods" do
|
48
|
+
context "populating relationship" do
|
49
|
+
should "return nil if the interface is nil" do
|
50
|
+
assert_nil @klass.populate_relationship(@parent, nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
should "return an initialized NATEngine" do
|
54
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
55
|
+
@klass.any_instance.stubs(:populate_relationships)
|
56
|
+
result = @klass.populate_relationship(@parent, @interface)
|
57
|
+
assert result.is_a?(@klass)
|
58
|
+
assert_equal @parent, result.parent
|
59
|
+
assert_equal @interface, result.interface
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "saving relationship" do
|
64
|
+
should "call save on each item" do
|
65
|
+
item = mock("item")
|
66
|
+
item.expects(:save)
|
67
|
+
@klass.save_relationship(nil, item)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "instance methods" do
|
73
|
+
setup do
|
74
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
75
|
+
@klass.any_instance.stubs(:populate_relationships)
|
76
|
+
@instance = @klass.new(@parent, @interface)
|
77
|
+
end
|
78
|
+
|
79
|
+
context "saving" do
|
80
|
+
setup do
|
81
|
+
@engine = mock("engine")
|
82
|
+
@instance.stubs(:modify_engine).yields(@engine)
|
83
|
+
end
|
84
|
+
|
85
|
+
should "save the interface attributes and relationships" do
|
86
|
+
@instance.expects(:save_changed_interface_attributes).with(@engine).once
|
87
|
+
@instance.expects(:save_relationships).once
|
88
|
+
@instance.save
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "modify engine" do
|
93
|
+
setup do
|
94
|
+
@adapter = mock("adapter")
|
95
|
+
@adapter.stubs(:nat_driver).returns(mock("nat_driver"))
|
96
|
+
@parent.stubs(:modify_adapter).yields(@adapter)
|
97
|
+
end
|
98
|
+
|
99
|
+
should "yield the NAT engine" do
|
100
|
+
@instance.modify_engine do |engine|
|
101
|
+
assert_equal @adapter.nat_driver, engine
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,222 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class NATForwardedPortTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::NATForwardedPort
|
6
|
+
|
7
|
+
@interface = mock("interface")
|
8
|
+
@caller = mock("caller")
|
9
|
+
@caller.stubs(:interface).returns(@interface)
|
10
|
+
end
|
11
|
+
|
12
|
+
context "validations" do
|
13
|
+
setup do
|
14
|
+
@collection = VirtualBox::Proxies::Collection.new(@caller)
|
15
|
+
|
16
|
+
@port = @klass.new
|
17
|
+
@port.name = "foo"
|
18
|
+
@port.guestport = "22"
|
19
|
+
@port.hostport = "2222"
|
20
|
+
@port.added_to_relationship(@collection)
|
21
|
+
end
|
22
|
+
|
23
|
+
should "be valid with all fields" do
|
24
|
+
assert @port.valid?
|
25
|
+
end
|
26
|
+
|
27
|
+
should "be invalid with no name" do
|
28
|
+
@port.name = nil
|
29
|
+
assert !@port.valid?
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be invalid with no guest port" do
|
33
|
+
@port.guestport = nil
|
34
|
+
assert !@port.valid?
|
35
|
+
end
|
36
|
+
|
37
|
+
should "be invalid with no host port" do
|
38
|
+
@port.hostport = nil
|
39
|
+
assert !@port.valid?
|
40
|
+
end
|
41
|
+
|
42
|
+
should "be invalid if not in a relationship" do
|
43
|
+
@port.write_attribute(:parent, nil)
|
44
|
+
assert !@port.valid?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "with an instance" do
|
49
|
+
setup do
|
50
|
+
@port = @klass.new({
|
51
|
+
:name => "foo",
|
52
|
+
:guestport => "22",
|
53
|
+
:hostport => "2222"
|
54
|
+
})
|
55
|
+
|
56
|
+
@collection = VirtualBox::Proxies::Collection.new(@caller)
|
57
|
+
@collection << @port
|
58
|
+
|
59
|
+
@port.clear_dirty!
|
60
|
+
end
|
61
|
+
|
62
|
+
context "initializing a new record" do
|
63
|
+
setup do
|
64
|
+
@port = @klass.new
|
65
|
+
end
|
66
|
+
|
67
|
+
should "be a new record" do
|
68
|
+
assert @port.new_record?
|
69
|
+
end
|
70
|
+
|
71
|
+
should "not be dirty" do
|
72
|
+
assert !@port.changed?
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "saving" do
|
77
|
+
setup do
|
78
|
+
@interface.stubs(:add_redirect)
|
79
|
+
@port.stubs(:destroy)
|
80
|
+
end
|
81
|
+
|
82
|
+
context "an existing record" do
|
83
|
+
setup do
|
84
|
+
@port.existing_record!
|
85
|
+
@caller.stubs(:modify_engine)
|
86
|
+
end
|
87
|
+
|
88
|
+
should "not do anything and return true if its unchanged" do
|
89
|
+
@caller.expects(:modify_engine).never
|
90
|
+
assert @port.save
|
91
|
+
end
|
92
|
+
|
93
|
+
should "clear the dirty state after saving" do
|
94
|
+
@port.name = "diff"
|
95
|
+
@port.save
|
96
|
+
assert !@port.changed?
|
97
|
+
end
|
98
|
+
|
99
|
+
should "call destroy if not a new record" do
|
100
|
+
@port.name = "diff"
|
101
|
+
@port.expects(:destroy).with(false).once
|
102
|
+
@port.save
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "a new record" do
|
107
|
+
setup do
|
108
|
+
@port.stubs(:valid?).returns(true)
|
109
|
+
@port.new_record!
|
110
|
+
assert @port.new_record?
|
111
|
+
|
112
|
+
@caller.stubs(:modify_engine)
|
113
|
+
end
|
114
|
+
|
115
|
+
should "no longer be a new record after saving" do
|
116
|
+
@port.save
|
117
|
+
assert !@port.new_record?
|
118
|
+
end
|
119
|
+
|
120
|
+
should "not call destroy" do
|
121
|
+
@port.expects(:destroy).never
|
122
|
+
@port.save
|
123
|
+
end
|
124
|
+
|
125
|
+
should "raise a ValidationFailedException if invalid and raise_errors is true" do
|
126
|
+
@port.expects(:valid?).returns(false)
|
127
|
+
assert_raises(VirtualBox::Exceptions::ValidationFailedException) {
|
128
|
+
@port.save
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
132
|
+
should "add the redirect to the nat engine" do
|
133
|
+
nat = mock("nat")
|
134
|
+
@caller.stubs(:modify_engine).yields(nat)
|
135
|
+
nat.expects(:add_redirect).with(@port.name,
|
136
|
+
@port.protocol,
|
137
|
+
"", @port.hostport,
|
138
|
+
"", @port.guestport)
|
139
|
+
@port.save
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context "destroying" do
|
145
|
+
setup do
|
146
|
+
@interface.stubs(:remove_redirect)
|
147
|
+
@nat = mock("nat")
|
148
|
+
@nat.stubs(:remove_redirect)
|
149
|
+
@caller.stubs(:modify_engine).yields(@nat)
|
150
|
+
end
|
151
|
+
|
152
|
+
should "remove itself from it's collection" do
|
153
|
+
assert @collection.include?(@port)
|
154
|
+
@port.destroy
|
155
|
+
assert !@collection.include?(@port)
|
156
|
+
end
|
157
|
+
|
158
|
+
should "not remove itself from collection if specified" do
|
159
|
+
assert @collection.include?(@port)
|
160
|
+
@port.destroy(false)
|
161
|
+
assert @collection.include?(@port)
|
162
|
+
end
|
163
|
+
|
164
|
+
should "remove the redirect from the nat engine interface" do
|
165
|
+
@nat.expects(:remove_redirect).with(@port.name).once
|
166
|
+
@port.destroy
|
167
|
+
end
|
168
|
+
|
169
|
+
should "do nothing if the record is new" do
|
170
|
+
@port.new_record!
|
171
|
+
@nat.expects(:remove_redirect).never
|
172
|
+
@port.destroy
|
173
|
+
end
|
174
|
+
|
175
|
+
should "be a new record after destroying" do
|
176
|
+
@port.destroy
|
177
|
+
assert @port.new_record?
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
context "relationships" do
|
183
|
+
context "saving" do
|
184
|
+
should "call #save on every object" do
|
185
|
+
objects = []
|
186
|
+
5.times do |i|
|
187
|
+
object = mock("object#{i}")
|
188
|
+
object.expects(:save).once
|
189
|
+
objects.push(object)
|
190
|
+
end
|
191
|
+
|
192
|
+
@klass.save_relationship(@caller, objects)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context "populating" do
|
197
|
+
setup do
|
198
|
+
@interface.stubs(:redirects).returns([
|
199
|
+
"foo,1,,2222,,22"
|
200
|
+
])
|
201
|
+
@objects = @klass.populate_relationship(@caller, @interface)
|
202
|
+
end
|
203
|
+
|
204
|
+
should "return an array of ForwardedPorts" do
|
205
|
+
assert @objects.is_a?(VirtualBox::Proxies::Collection)
|
206
|
+
assert @objects.all? { |o| o.is_a?(@klass) }
|
207
|
+
end
|
208
|
+
|
209
|
+
should "have the proper data" do
|
210
|
+
object = @objects.first
|
211
|
+
assert_equal 22, object.guestport
|
212
|
+
assert_equal 2222, object.hostport
|
213
|
+
assert_equal :tcp, object.protocol
|
214
|
+
assert_equal @objects, object.parent_collection
|
215
|
+
end
|
216
|
+
|
217
|
+
should "be existing records" do
|
218
|
+
assert !@objects.first.new_record?
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class NetworkAdapterTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::NetworkAdapter
|
6
|
+
@interface = mock("interface")
|
7
|
+
@parent = mock("parent")
|
8
|
+
end
|
9
|
+
|
10
|
+
context "initializing" do
|
11
|
+
should "load attributes from the machine" do
|
12
|
+
@klass.any_instance.expects(:initialize_attributes).with(@parent, @interface).once
|
13
|
+
@klass.new(@parent, @interface)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "initializing attributes" do
|
18
|
+
setup do
|
19
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
20
|
+
@klass.any_instance.stubs(:populate_relationships)
|
21
|
+
|
22
|
+
@instance = @klass.new(@parent, @interface)
|
23
|
+
end
|
24
|
+
|
25
|
+
should "load interface attribtues" do
|
26
|
+
@klass.any_instance.expects(:load_interface_attributes).with(@interface).once
|
27
|
+
@klass.new(@parent, @interface)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "setup the parent" do
|
31
|
+
assert_equal @parent, @instance.parent
|
32
|
+
end
|
33
|
+
|
34
|
+
should "setup the interface" do
|
35
|
+
assert_equal @interface, @instance.interface
|
36
|
+
end
|
37
|
+
|
38
|
+
should "not be dirty" do
|
39
|
+
assert !@instance.changed?
|
40
|
+
end
|
41
|
+
|
42
|
+
should "be existing record" do
|
43
|
+
assert !@instance.new_record?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "class methods" do
|
48
|
+
context "populating relationship" do
|
49
|
+
setup do
|
50
|
+
@instance = mock("instance")
|
51
|
+
@klass.stubs(:new).returns(@instance)
|
52
|
+
|
53
|
+
@count = 5
|
54
|
+
@vbox = mock("vbox")
|
55
|
+
@system_properties = mock("sys_props")
|
56
|
+
@interface.stubs(:parent).returns(@vbox)
|
57
|
+
@vbox.stubs(:system_properties).returns(@system_properties)
|
58
|
+
@system_properties.stubs(:network_adapter_count).returns(@count)
|
59
|
+
end
|
60
|
+
|
61
|
+
should "return a proxied collection" do
|
62
|
+
@system_properties.stubs(:network_adapter_count).returns(0)
|
63
|
+
result = @klass.populate_relationship(nil, @interface)
|
64
|
+
assert result.is_a?(VirtualBox::Proxies::Collection)
|
65
|
+
end
|
66
|
+
|
67
|
+
should "call new for every shared folder" do
|
68
|
+
expected_result = []
|
69
|
+
new_seq = sequence("new_seq")
|
70
|
+
@count.times do |i|
|
71
|
+
expected_value = "instance-#{i}"
|
72
|
+
adapter = mock("adapter#{i}")
|
73
|
+
@interface.expects(:get_network_adapter).with(i).returns(adapter).in_sequence(new_seq)
|
74
|
+
@klass.expects(:new).with(@parent, adapter).in_sequence(new_seq).returns(expected_value)
|
75
|
+
expected_result << expected_value
|
76
|
+
end
|
77
|
+
|
78
|
+
assert_equal expected_result, @klass.populate_relationship(@parent, @interface)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "saving relationship" do
|
83
|
+
should "call save on each item" do
|
84
|
+
items = (1..5).to_a.collect do |i|
|
85
|
+
item = mock("item-#{i}")
|
86
|
+
item.expects(:save).once
|
87
|
+
item
|
88
|
+
end
|
89
|
+
|
90
|
+
@klass.save_relationship(nil, items)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "instance methods" do
|
96
|
+
setup do
|
97
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
98
|
+
@instance = @klass.new(@parent, @interface)
|
99
|
+
end
|
100
|
+
|
101
|
+
context "host interface object" do
|
102
|
+
setup do
|
103
|
+
@network_interfaces = []
|
104
|
+
@host = mock("host")
|
105
|
+
VirtualBox::Global.global.stubs(:host).returns(@host)
|
106
|
+
@host.stubs(:network_interfaces).returns(@network_interfaces)
|
107
|
+
end
|
108
|
+
|
109
|
+
def stub_interface(name)
|
110
|
+
interface = mock("interface")
|
111
|
+
interface.stubs(:name).returns(name)
|
112
|
+
@network_interfaces << interface
|
113
|
+
interface
|
114
|
+
end
|
115
|
+
|
116
|
+
should "return the network interface associated with the adapter" do
|
117
|
+
name = "foo"
|
118
|
+
result = stub_interface(name)
|
119
|
+
@instance.host_interface = name
|
120
|
+
assert_equal result, @instance.host_interface_object
|
121
|
+
end
|
122
|
+
|
123
|
+
should "return nil if the interface is not found" do
|
124
|
+
stub_interface("foo")
|
125
|
+
@instance.host_interface = "bar"
|
126
|
+
assert_nil @instance.host_interface_object
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context "saving" do
|
131
|
+
setup do
|
132
|
+
@adapter = mock("adapter")
|
133
|
+
@instance.stubs(:modify_adapter).yields(@adapter)
|
134
|
+
end
|
135
|
+
|
136
|
+
should "save the attachment type and interface attributes on the open adapter" do
|
137
|
+
@instance.expects(:save_attachment_type).with(@adapter).once
|
138
|
+
@instance.expects(:save_changed_interface_attributes).with(@adapter).once
|
139
|
+
@instance.expects(:save_relationships).once
|
140
|
+
@instance.save
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context "saving attachment type" do
|
145
|
+
setup do
|
146
|
+
@adapter = mock("adapter")
|
147
|
+
@instance.attachment_type = :nat
|
148
|
+
end
|
149
|
+
|
150
|
+
should "do nothing if attachment type is not changed" do
|
151
|
+
@instance.clear_dirty!
|
152
|
+
assert !@instance.attachment_type_changed?
|
153
|
+
@instance.expects(:attach_to_nat).never
|
154
|
+
|
155
|
+
@instance.save_attachment_type(@adapter)
|
156
|
+
end
|
157
|
+
|
158
|
+
should "run the proper method if it has changed" do
|
159
|
+
@adapter.expects(:attach_to_nat).once
|
160
|
+
@instance.save_attachment_type(@adapter)
|
161
|
+
end
|
162
|
+
|
163
|
+
should "clear the dirty state" do
|
164
|
+
@adapter.stubs(:attach_to_nat)
|
165
|
+
@instance.save_attachment_type(@adapter)
|
166
|
+
assert !@instance.attachment_type_changed?
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context "modifying the adapter" do
|
171
|
+
setup do
|
172
|
+
@machine = mock("machine")
|
173
|
+
@session = mock("session")
|
174
|
+
@session.stubs(:machine).returns(@machine)
|
175
|
+
@instance.expects(:parent_machine).returns(@parent)
|
176
|
+
|
177
|
+
@adapter = mock("adapter")
|
178
|
+
end
|
179
|
+
|
180
|
+
should "open a session, yield the proper adapter, then save settings" do
|
181
|
+
seq = sequence("sequence")
|
182
|
+
@parent.expects(:with_open_session).yields(@session).in_sequence(seq)
|
183
|
+
@machine.expects(:get_network_adapter).with(@instance.slot).returns(@adapter).in_sequence(seq)
|
184
|
+
|
185
|
+
@instance.modify_adapter do |adapter|
|
186
|
+
assert_equal @adapter, adapter
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|