protected org.ovirt.engine.core.common.businessentities.VmTemplate getTemplateEntity() { VmTemplate entity = mock(VmTemplate.class); when(entity.getId()).thenReturn(GUIDS[1]); when(entity.getClusterId()).thenReturn(GUIDS[2]); when(entity.getName()).thenReturn(NAMES[1]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[1]); when(entity.getNumOfCpus()).thenReturn(8); when(entity.getNumOfSockets()).thenReturn(2); when(entity.getDefaultDisplayType()).thenReturn(DisplayType.vga); when(entity.getNumOfMonitors()).thenReturn(2); when(entity.getVmType()).thenReturn(VmType.Server); return entity; }
private void createVMFromTemplate() { VmTemplate template = getSelectedItem(); final List<UICommand> commands = new ArrayList<>(); commands.add(UICommand.createDefaultOkUiCommand("OnSaveVm", this)); //$NON-NLS-1$ commands.add(UICommand.createCancelUiCommand("Cancel", this)); //$NON-NLS-1$ AsyncDataProvider.getInstance().getTemplateById(new AsyncQuery<>(withVmInit -> setupNewVmModel(new UnitVmModel(new NewVmFromTemplateModelBehavior(withVmInit), TemplateListModel.this), withVmInit.getVmType(), commands)), template.getId()); }
private void vmInitLoaded(VmTemplate template) { UnitVmModel model = createModel(createBehavior(template)); model.setIsAdvancedModeLocalStorageKey(getEditTemplateAdvancedModelKey()); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().editTemplateTitle()); model.setHelpTag(HelpTag.edit_template); model.setHashName("edit_template"); //$NON-NLS-1$ model.getVmType().setSelectedItem(template.getVmType()); model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList()); model.initialize(); VmBasedWidgetSwitchModeCommand switchModeCommand = new VmBasedWidgetSwitchModeCommand(); switchModeCommand.init(model); model.getCommands().add(switchModeCommand); UICommand onSaveCommand = UICommand.createDefaultOkUiCommand("OnSave", this); //$NON-NLS-1$ model.getCommands().add(onSaveCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$ model.getCommands().add(cancelCommand); model.getIsHighlyAvailable().setEntity(template.isAutoStartup()); if (template.getDefaultDisplayType() == DisplayType.none) { model.getIsHeadlessModeEnabled().setEntity(true); } }
setOptimizedForSystemProfile(translator.translate(template.getVmType()));
staticVm.setDeleteProtected(entity.isDeleteProtected()); staticVm.setSsoMethod(entity.getSsoMethod()); staticVm.setVmType(entity.getVmType()); staticVm.setIsoPath(entity.getIsoPath()); staticVm.setKernelUrl(entity.getKernelUrl());
getModel().getVmType().setSelectedItem(template.getVmType()); getModel().getUsbPolicy().setSelectedItem(template.getUsbPolicy()); updateRngDevice(template.getId());
obj.setClusterName(instance.getClusterName()); obj.setClusterCompatibilityVersion(instance.getClusterCompatibilityVersion()); obj.setVmType(instance.getVmType()); obj.setId(instance.getId()); obj.setDiskList(instance.getDiskList());