private VmTemplate getTemplate() { VmTemplate template = new VmTemplate(); template.setId(TEMPLATE_ID); template.setIsoPath(ISO_PATH); return template; }
private VmTemplate getTemplate() { VmTemplate template = new VmTemplate(); template.setId(TEMPLATE_ID); template.setIsoPath(ISO_PATH); return template; }
@Override public VmTemplate mapRow(ResultSet rs, int rowNum) throws SQLException { final VmTemplate entity = new VmTemplate(); map(rs, entity); entity.setId(getGuidDefaultEmpty(rs, "vmt_guid")); entity.setChildCount(rs.getInt("child_count")); entity.setName(rs.getString("name")); entity.setClusterId(getGuid(rs, "cluster_id")); entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status"))); entity.setClusterName(rs.getString("cluster_name")); entity.setClusterCompatibilityVersion(new VersionRowMapper("cluster_compatibility_version").mapRow(rs, rowNum)); entity.setStoragePoolId(getGuid(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setQuotaName(rs.getString("quota_name")); entity.setQuotaEnforcementType(QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setDisabled(rs.getBoolean("is_disabled")); entity.setTrustedService(rs.getBoolean("trusted_service")); entity.setTemplateType(VmEntityType.valueOf(rs.getString("entity_type"))); entity.setClusterArch(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setBaseTemplateId(getGuidDefaultEmpty(rs, "base_template_id")); entity.setTemplateVersionNumber(rs.getInt("template_version_number")); entity.setTemplateVersionName(rs.getString("template_version_name")); return entity; } }
@Override protected void readGeneralData(XmlNode content) { super.readGeneralData(content); consumeReadProperty(content, TEMPLATE_ID, val -> _vmTemplate.setId(new Guid(val))); consumeReadProperty(content, IS_DISABLED, val -> _vmTemplate.setDisabled(Boolean.parseBoolean(val))); consumeReadProperty(content, TRUSTED_SERVICE, val -> _vmTemplate.setTrustedService(Boolean.parseBoolean(val))); consumeReadProperty(content, TEMPLATE_TYPE, val -> _vmTemplate.setTemplateType(VmEntityType.valueOf(val))); consumeReadProperty(content, BASE_TEMPLATE_ID, val -> _vmTemplate.setBaseTemplateId(Guid.createGuidFromString(val)), () -> { // in case base template is missing, we assume it is a base template _vmTemplate.setBaseTemplateId(_vmTemplate.getId()); }); consumeReadProperty(content, TEMPLATE_VERSION_NUMBER, val -> _vmTemplate.setTemplateVersionNumber(Integer.parseInt(val))); consumeReadProperty(content, TEMPLATE_VERSION_NAME, val -> _vmTemplate.setTemplateVersionName(val)); consumeReadProperty(content, AUTO_STARTUP, val -> _vmTemplate.setAutoStartup(Boolean.parseBoolean(val))); }
t.setId(GUID); t.setName(NAME); when(vmTemplateDao.get(Guid.Empty)).thenReturn(t);
protected void setUpUnitVmModelExpectations(UnitVmModel model) { when(model.getVmType().getSelectedItem()).thenReturn(VM_TYPE); VmTemplate template = new VmTemplate(); template.setId(TEMPLATE_GUID); TemplateWithVersion templateWithVersion = mock(TemplateWithVersion.class); when(templateWithVersion.getTemplateVersion()).thenReturn(template);
@Override protected VmTemplate generateNewEntity() { VmTemplate newVmTemplate = new VmTemplate(); newVmTemplate.setId(Guid.newGuid()); newVmTemplate.setName("NewVmTemplate"); newVmTemplate.setClusterId(FixturesTool.CLUSTER); newVmTemplate.setClusterArch(ArchitectureType.x86_64); newVmTemplate.setCpuProfileId(FixturesTool.CPU_PROFILE_2); newVmTemplate.setSmallIconId(FixturesTool.SMALL_ICON_ID); newVmTemplate.setLargeIconId(FixturesTool.LARGE_ICON_ID); return newVmTemplate; }
static org.ovirt.engine.core.common.businessentities.VmTemplate setUpEntityExpectations( org.ovirt.engine.core.common.businessentities.VmTemplate entity, int index) { entity.setId(GUIDS[index]); entity.setClusterId(GUIDS[2]); entity.setName(NAMES[index]); entity.setDescription(DESCRIPTIONS[index]); entity.setCpuPerSocket(4); entity.setNumOfSockets(2); entity.setDefaultDisplayType(DisplayType.qxl); entity.setNumOfMonitors(2); entity.setVmType(VmType.Server); return entity; }
obj.setClusterCompatibilityVersion(instance.getClusterCompatibilityVersion()); obj.setVmType(instance.getVmType()); obj.setId(instance.getId()); obj.setDiskList(instance.getDiskList()); obj.setRunAndPause(instance.isRunAndPause());