use of org.ovirt.engine.core.common.businessentities.UsbPolicy in project ovirt-engine by oVirt.
the class UnitVmModel method initUsbPolicy.
private void initUsbPolicy() {
GraphicsTypes graphicsTypes = getGraphicsType().getSelectedItem();
if (graphicsTypes == null) {
return;
}
getUsbPolicy().setIsChangeable(true);
UsbPolicy prevSelectedUsbPolicy = getUsbPolicy().getSelectedItem();
getUsbPolicy().setItems(Arrays.asList(UsbPolicy.DISABLED, UsbPolicy.ENABLED_NATIVE));
if (!graphicsTypes.getBackingGraphicsTypes().contains(GraphicsType.SPICE)) {
getUsbPolicy().setIsChangeable(false);
}
if (getBehavior().basedOnCustomInstanceType()) {
Collection<UsbPolicy> policies = getUsbPolicy().getItems();
if (policies.contains(prevSelectedUsbPolicy)) {
getUsbPolicy().setSelectedItem(prevSelectedUsbPolicy);
} else if (policies.size() > 0) {
getUsbPolicy().setSelectedItem(getVmType().getSelectedItem() == VmType.HighPerformance ? UsbPolicy.DISABLED : policies.iterator().next());
}
}
}
use of org.ovirt.engine.core.common.businessentities.UsbPolicy in project ovirt-engine by oVirt.
the class VmMapperTest method getUsbPolicyOnUpdateCurrentlyDisabledGotNullUsb.
@Test
public void getUsbPolicyOnUpdateCurrentlyDisabledGotNullUsb() {
Usb usb = null;
UsbPolicy currentPolicy = UsbPolicy.DISABLED;
assertEquals(VmMapper.getUsbPolicyOnUpdate(usb, currentPolicy), currentPolicy);
}
use of org.ovirt.engine.core.common.businessentities.UsbPolicy in project ovirt-engine by oVirt.
the class VmMapperTest method getUsbPolicyOnUpdateCurrentlyNativeGotEnabledNotSetPolicyNotSetUsb.
@Test
public void getUsbPolicyOnUpdateCurrentlyNativeGotEnabledNotSetPolicyNotSetUsb() {
Usb usb = new Usb();
UsbPolicy currentPolicy = UsbPolicy.ENABLED_NATIVE;
assertEquals(VmMapper.getUsbPolicyOnUpdate(usb, currentPolicy), currentPolicy);
}
use of org.ovirt.engine.core.common.businessentities.UsbPolicy in project ovirt-engine by oVirt.
the class UsbMapperUtilsTest method getUsbTypeEnabledNative.
@Test
public void getUsbTypeEnabledNative() {
UsbPolicy usbPolicy = UsbPolicy.ENABLED_NATIVE;
assertEquals(UsbType.NATIVE, UsbMapperUtils.getUsbType(usbPolicy));
}
use of org.ovirt.engine.core.common.businessentities.UsbPolicy in project ovirt-engine by oVirt.
the class UsbMapperUtilsTest method getIsUsbEnabledEnabledNative.
@Test
public void getIsUsbEnabledEnabledNative() {
UsbPolicy usbPolicy = UsbPolicy.ENABLED_NATIVE;
assertTrue(UsbMapperUtils.getIsUsbEnabled(usbPolicy));
}
Aggregations