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; }
static VmTemplate setUpEntityExpectations(VmTemplate entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getClusterId()).thenReturn(GUIDS[2]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getNumOfCpus()).thenReturn(8); when(entity.getNumOfSockets()).thenReturn(2); when(entity.getThreadsPerCpu()).thenReturn(1); when(entity.getCpuPerSocket()).thenReturn(4); if(index == 2) { when(entity.getTemplateVersionName()).thenReturn(VERSION_NAME); when(entity.getTemplateVersionNumber()).thenReturn(2); when(entity.getBaseTemplateId()).thenReturn(GUIDS[1]); when(entity.isBaseTemplate()).thenReturn(false); } else { when(entity.getTemplateVersionNumber()).thenReturn(1); // same base template id as the template itself when(entity.getBaseTemplateId()).thenReturn(GUIDS[index]); when(entity.isBaseTemplate()).thenReturn(true); } when(entity.getSmallIconId()).thenReturn(GUIDS[2]); when(entity.getLargeIconId()).thenReturn(GUIDS[3]); return entity; }
/** * Ensures that the templates for the given vds group are returned. */ @Test public void testGetAllForCluster() { List<VmTemplate> result = dao.getAllForCluster(FixturesTool.CLUSTER); assertGetAllResult(result); for (VmTemplate template : result) { assertEquals(FixturesTool.CLUSTER, template.getClusterId()); } }
Guid clusterId = selectedDCWithCluster != null ? selectedDCWithCluster.getCluster().getId() : selectedTemplate.getClusterId(); for (VmTemplate template : templates) { if (template.getBaseTemplateId().equals(baseTemplateId)) { if (template.getClusterId() == null || template.getClusterId().equals(clusterId)) { relatedTemplates.add(template);
protected void initClusters(final List<StoragePool> dataCenters) { AsyncDataProvider.getInstance().getClusterListByService( new AsyncQuery<>(clusters -> { List<Cluster> filteredClusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, selectedTemplate.getClusterArch()); getModel().setDataCentersAndClusters(getModel(), dataCenters, filteredClusters, selectedTemplate.getClusterId()); initCdImage(); }), true, false); }
public Cluster getCluster() { if (cluster == null) { if (clusterId != null) { cluster = clusterDao.get(clusterId); } else if (getVds() != null) { clusterId = getVds().getClusterId(); cluster = clusterDao.get(clusterId); } else if (getVm() != null) { clusterId = getVm().getClusterId(); cluster = clusterDao.get(clusterId); } else if (getVmTemplate() != null) { clusterId = getVmTemplate().getClusterId(); cluster = clusterDao.get(clusterId); } } return cluster; }
new ArrayList<>(Arrays.asList(new StoragePool[]{dataCenter})), filteredClusters, template.getClusterId());
&& !Objects.equals(Objects.toString(template.getClusterId(), null), vm.getCluster().getId())) { builtFromTemplate.setCpuProfileId(null);
staticVm.setClusterId(entity.getClusterId()); staticVm.setOsId(entity.getOsId()); staticVm.setNiceLevel(entity.getNiceLevel());
obj.setTimeZone(instance.getTimeZone()); obj.setUsbPolicy(instance.getUsbPolicy()); obj.setClusterId(instance.getClusterId()); obj.setClusterName(instance.getClusterName()); obj.setClusterCompatibilityVersion(instance.getClusterCompatibilityVersion());