static org.ovirt.engine.core.common.businessentities.InstanceType setUpEntityExpectations(VmTemplate entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); 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); when(entity.isBaseTemplate()).thenReturn(true); return entity; }
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; }
setCpuInfo(ConstantsManager.getInstance().getMessages().cpuInfoLabel( template.getNumOfCpus(), template.getNumOfSockets(), template.getCpuPerSocket(), template.getThreadsPerCpu()));
obj.setNumOfMonitors(instance.getNumOfMonitors()); obj.setAllowConsoleReconnect(instance.isAllowConsoleReconnect()); obj.setNumOfSockets(instance.getNumOfSockets()); obj.setStatus(instance.getStatus()); obj.setTimeZone(instance.getTimeZone());