auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onVdsDuringFailureTimer ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( getVdsId ( ) ) ; if ( ( vds.getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Error ) ) { setStatus ( VDSStatus.Up , vds ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDynamicDao ( ) . updateStatus ( getVdsId ( ) , VDSStatus.Up ) ; org.ovirt.engine.core.vdsbroker.VdsManager.log.infoFormat ( "onVdsDuringFailureTimer of Host {0} entered after {1} attempts to run a VM" , vds.getName ( ) , mFailedToRunVmAttempts ) ; mFailedToRunVmAttempts.set ( 0 ) ; } }

Target:
public void recoverFromError ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( getVdsId ( ) ) ; if ( ( vds.getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Error ) ) { setStatus ( VDSStatus.Up , vds ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDynamicDao ( ) . updateStatus ( getVdsId ( ) , VDSStatus.Up ) ; org.ovirt.engine.core.vdsbroker.VdsManager.log.infoFormat ( "recoverFromError of Host {0} entered after {1} attempts to run a VM" , vds.getName ( ) , mFailedToRunVmAttempts ) ; mFailedToRunVmAttempts.set ( 0 ) ; } }
Source:
public int compare ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain1 , org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain2 ) { return storageDomain1.getAvailableDiskSize ( ) . compareTo ( storageDomain2.getAvailableDiskSize ( ) ) ; }

Target:
public org.ovirt.engine.core.common.businessentities.StorageDomain getSelectedStorageDomain ( ) { if ( ( ( selectedStorageDomain ) == null ) && ( ! ( storageDomains.isEmpty ( ) ) ) ) { selectedStorageDomain = java.util.Collections.max ( storageDomains , java.util.Comparator.comparing ( StorageDomain :: getAvailableDiskSize ) ) ; } return selectedStorageDomain ; }
Source:
public void testGetPermittedStorageDomains ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > result = dao.getPermittedStorageDomainsByStoragePool ( org.ovirt.engine.core.dao.StorageDomainDAOTest.EXISTING_USER_ID , ActionGroup.CONFIGURE_VM_STORAGE , org.ovirt.engine.core.dao.StorageDomainDAOTest.EXISTING_STORAGE_POOL_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( result.get ( 0 ) . getId ( ) , existingDomain.getId ( ) ) ; }

Target:
public void testGetPermittedStorageDomains ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > result = dao.getPermittedStorageDomainsByStoragePool ( org.ovirt.engine.core.dao.StorageDomainDAOTest.EXISTING_USER_ID , ActionGroup.CONFIGURE_VM_STORAGE , new org.ovirt.engine.core.compat.Guid ( "6d849ebf-755f-4552-ad09-9a090cda105d" ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( result.get ( 0 ) . getId ( ) , existingDomain.getId ( ) ) ; }
Source:
public boolean checkIfCpusExist ( java.lang.String cpuName , org.ovirt.engine.core.compat.Version ver ) { final org.ovirt.engine.core.bll.CpuFlagsManagerHandler.CpuFlagsManager cpuFlagsManager = org.ovirt.engine.core.bll.CpuFlagsManagerHandler._managersDictionary.get ( ver ) ; if ( cpuFlagsManager != null ) { return cpuFlagsManager.checkIfCpusExist ( cpuName ) ; } return false ; }

Target:
public boolean checkIfCpusSameManufacture ( java.lang.String cpuName1 , java.lang.String cpuName2 ) { if ( ( cpuName1 == null ) || ( cpuName2 == null ) ) { return false ; } if ( intelCpuByNameDictionary.containsKey ( cpuName1 ) ) { return intelCpuByNameDictionary.containsKey ( cpuName2 ) ; } if ( amdCpuByNameDictionary.containsKey ( cpuName1 ) ) { return amdCpuByNameDictionary.containsKey ( cpuName2 ) ; } if ( ibmCpuByNameDictionary.containsKey ( cpuName1 ) ) { return ibmCpuByNameDictionary.containsKey ( cpuName2 ) ; } return false ; }
Source:
public void setup ( ) throws java.lang.Exception { validator = org.ovirt.engine.core.common.utils.ValidationUtils.getValidator ( ) ; org.ovirt.engine.core.common.config.IConfigUtilsInterface confUtils = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.config.IConfigUtilsInterface.class ) ; org.mockito.Mockito.when ( confUtils.getValue ( ConfigValues.ManagementNetwork , ConfigCommon.defaultConfigurationVersion ) ) . thenReturn ( org.ovirt.engine.core.common.utils.MTUValidatorTest.TEST_MANAGEMENT_NETWORK ) ; org.ovirt.engine.core.common.config.Config.setConfigUtils ( confUtils ) ; }

Target:
public void setup ( ) throws java.lang.Exception { validator = org.ovirt.engine.core.common.utils.ValidationUtils.getValidator ( ) ; org.ovirt.engine.core.common.config.IConfigUtilsInterface confUtils = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.config.IConfigUtilsInterface.class ) ; org.mockito.Mockito.when ( confUtils.getValue ( ConfigValues.DefaultManagementNetwork , ConfigCommon.defaultConfigurationVersion ) ) . thenReturn ( org.ovirt.engine.core.common.utils.MTUValidatorTest.TEST_MANAGEMENT_NETWORK ) ; org.ovirt.engine.core.common.config.Config.setConfigUtils ( confUtils ) ; }
Source:
public void moveDiskToGluster ( ) { initializeCommand ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( StorageType.GLUSTERFS ) ; initVmDiskImage ( false ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }

Target:
public void moveShareableDisk ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage disk = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; disk.setShareable ( true ) ; initializeCommand ( disk , VmEntityType.VM ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( StorageType.NFS ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }
Source:
private boolean validateInputManagementNetwork ( ) { setManagementNetwork ( getManagementNetworkById ( ) ) ; if ( ( getManagementNetwork ( ) ) == null ) { addValidationMessage ( EngineMessage.NETWORK_NOT_EXISTS ) ; return false ; } final org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorBase networkClusterValidator = createNetworkClusterValidator ( ) ; return ( ( validate ( networkClusterValidator.networkBelongsToClusterDataCenter ( org.ovirt.engine.core.bll.AddClusterCommand.getCluster ( ) , getManagementNetwork ( ) ) ) ) && ( validate ( networkClusterValidator.managementNetworkRequired ( getManagementNetwork ( ) ) ) ) ) && ( validate ( networkClusterValidator.managementNetworkNotExternal ( getManagementNetwork ( ) ) ) ) ; }

Target:
protected boolean validateInputManagementNetwork ( ) { if ( ! ( org.ovirt.engine.core.bll.AddClusterCommand.findInputManagementNetwork ( ) ) ) { return false ; } final org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorBase networkClusterValidator = createNetworkClusterValidator ( ) ; return ( ( validate ( networkClusterValidator.networkBelongsToClusterDataCenter ( org.ovirt.engine.core.bll.AddClusterCommand.getCluster ( ) , managementNetwork ) ) ) && ( validate ( networkClusterValidator.managementNetworkRequired ( managementNetwork ) ) ) ) && ( validate ( networkClusterValidator.managementNetworkNotExternal ( managementNetwork ) ) ) ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult evaluate ( java.util.Map.Entry < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.bll.validator.StorageDomainValidator > entry ) { org.ovirt.engine.core.compat.Guid sdId = entry.getKey ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > newDisksForDomain = domainsNewDisksMap.get ( sdId ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > clonedDisksForDomain = domainsClonedDisksMap.get ( sdId ) ; return getStorageDomainValidator ( entry ) . hasSpaceForAllDisks ( newDisksForDomain , clonedDisksForDomain ) ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult evaluate ( java.util.Map.Entry < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.bll.validator.StorageDomainValidator > entry ) { org.ovirt.engine.core.compat.Guid sdId = entry.getKey ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > disksList = disksMap.get ( sdId ) ; return getStorageDomainValidator ( entry ) . hasSpaceForNewDisks ( disksList ) ; }
Source:
public static void getAllVnicProfiles ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VnicProfileView > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllVnicProfiles , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }

Target:
public void getVmGuestAgentInterfacesByVmId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmGuestAgentInterfacesByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) . withoutRefresh ( ) , aQuery ) ; }
Source:
public void scheduleJob ( ) { scheduler.scheduleAFixedDelayJob ( this , "checkCertificationValidity" , new java.lang.Class [ 0 ] , new java.lang.Object [ 0 ] , 10 , java.util.concurrent.TimeUnit.HOURS.toMinutes ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.CertificationValidityCheckTimeInHours ) ) , java.util.concurrent.TimeUnit.MINUTES ) ; }

Target:
public void scheduleJob ( ) { double interval = org.ovirt.engine.core.common.config.Config.< java.lang.Double > getValue ( ConfigValues.CertificationValidityCheckTimeInHours ) ; final int HOURS_TO_MINUTES = 60 ; long intervalInMinutes = java.lang.Math.round ( ( interval * HOURS_TO_MINUTES ) ) ; scheduler.scheduleAFixedDelayJob ( this , "checkCertificationValidity" , new java.lang.Class [ 0 ] , new java.lang.Object [ 0 ] , 10 , intervalInMinutes , java.util.concurrent.TimeUnit.MINUTES ) ; }
Source:
public void testAddHostedEngineStorageFails ( ) { org.mockito.Mockito.when ( command.getLUNsFromVgInfo ( parameters.getStorageDomain ( ) . getStorage ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.storage.AddExistingBlockStorageDomainCommandTest.getLUNs ( ) ) ; org.mockito.Mockito.doReturn ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.LUNs > ( ) ) . when ( command ) . getAllLuns ( ) ; parameters.getStorageDomain ( ) . setStorageName ( StorageConstants.HOSTED_ENGINE_STORAGE_DOMAIN_NAME ) ; org.junit.Assert.assertFalse ( command.canAddDomain ( ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.assertCanDoActionMessages ( "Add self hosted engine storage domain succeeded where it should have failed" , command , VdcBllMessages.ACTION_TYPE_FAILED_HOSTED_ENGINE_STORAGE ) ; }

Target:
public void testAddExistingBlockDomainSuccessfully ( ) { org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.storage.AddExistingBlockStorageDomainCommandTest.getLUNs ( ) ) . when ( command ) . getLUNsFromVgInfo ( parameters.getStorageDomain ( ) . getStorage ( ) ) ; command.executeCommand ( ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getSucceeded ( ) ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.AsyncTaskStatus CheckTaskExist ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatus cachedStatusTask ) { org.ovirt.engine.core.common.businessentities.AsyncTaskStatus returnedStatusTask = null ; if ( cachedStatusTask == null ) { returnedStatusTask = new org.ovirt.engine.core.common.businessentities.AsyncTaskStatus ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.unknown ) ; org.ovirt.engine.core.bll.tasks.SPMAsyncTask.log.errorFormat ( ( "SPMAsyncTask::PollTask: Task '{0}' (Parent Command {1}, Parameters Type {2}) " + "was not found in VDSM, will change its status to unknown." ) , getVdsmTaskId ( ) , getParameters ( ) . getDbAsyncTask ( ) . getaction_type ( ) , getParameters ( ) . getClass ( ) . getName ( ) ) ; } else { returnedStatusTask = cachedStatusTask ; } return returnedStatusTask ; }

Target:
protected org.ovirt.engine.core.common.businessentities.AsyncTaskStatus checkTaskExist ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatus cachedStatusTask ) { org.ovirt.engine.core.common.businessentities.AsyncTaskStatus returnedStatusTask = null ; if ( cachedStatusTask == null ) { returnedStatusTask = new org.ovirt.engine.core.common.businessentities.AsyncTaskStatus ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.unknown ) ; org.ovirt.engine.core.bll.tasks.SPMAsyncTask.log.errorFormat ( ( "SPMAsyncTask::PollTask: Task '{0}' (Parent Command {1}, Parameters Type {2}) " + "was not found in VDSM, will change its status to unknown." ) , getVdsmTaskId ( ) , getParameters ( ) . getDbAsyncTask ( ) . getaction_type ( ) , getParameters ( ) . getClass ( ) . getName ( ) ) ; } else { returnedStatusTask = cachedStatusTask ; } return returnedStatusTask ; }
Source:
public static boolean setDiskAlias ( org.ovirt.engine.core.common.businessentities.BaseDisk disk , org.ovirt.engine.core.common.businessentities.VM vm ) { if ( disk != null ) { java.lang.String vmName = "" ; int count = 1 ; if ( vm != null ) { vmName = vm.getVmName ( ) ; count = ( vm.getDiskMapCount ( ) ) + 1 ; } disk.setDiskAlias ( org.ovirt.engine.core.bll.ImagesHandler.getSuggestedDiskAlias ( disk , vmName , count ) ) ; return true ; } else { org.ovirt.engine.core.bll.ImagesHandler.log.errorFormat ( "Disk object is null" ) ; return false ; } }

Target:
private static int nullSafeGetCount ( org.ovirt.engine.core.common.businessentities.VM vm ) { return vm == null ? 1 : ( vm.getDiskMapCount ( ) ) + 1 ; }
Source:
public java.util.List getClusterLevelsList ( ) { java.util.List resultList = lst ( ) ; resultList.add ( "3.0" ) ; resultList.add ( "3.1" ) ; resultList.add ( "3.2" ) ; resultList.add ( "3.3" ) ; resultList.add ( "3.4" ) ; resultList.add ( "3.5" ) ; resultList.add ( "3.6" ) ; resultList.add ( "4.0" ) ; return resultList ; }

Target:
public java.util.List getClusterLevelsList ( ) { java.util.List resultList = lst ( ) ; resultList.add ( "3.0" ) ; resultList.add ( "3.1" ) ; resultList.add ( "3.2" ) ; resultList.add ( "3.3" ) ; resultList.add ( "3.4" ) ; resultList.add ( "3.5" ) ; resultList.add ( "3.6" ) ; resultList.add ( "4.0" ) ; resultList.add ( "4.1" ) ; return resultList ; }
Source:
private void initInfoIcons ( org.ovirt.engine.ui.webadmin.ApplicationResources resources , org.ovirt.engine.ui.webadmin.ApplicationConstants constants , org.ovirt.engine.ui.webadmin.ApplicationTemplates templates ) { memoryOptimizationInfo = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( templates.italicFixedWidth ( "465px" , constants.clusterPopupMemoryOptimizationInfo ( ) ) , resources ) ; cpuThreadsInfo = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( templates.italicFixedWidth ( "600px" , constants.clusterPopupCpuThreadsInfo ( ) ) , resources ) ; schedulerOptimizationInfoIcon = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( com.google.gwt.safehtml.shared.SafeHtmlUtils.EMPTY_SAFE_HTML , resources ) ; }

Target:
private void initInfoIcons ( org.ovirt.engine.ui.webadmin.ApplicationResources resources , org.ovirt.engine.ui.webadmin.ApplicationConstants constants , org.ovirt.engine.ui.webadmin.ApplicationTemplates templates ) { memoryOptimizationInfo = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( templates.italicFixedWidth ( "465px" , constants.clusterPopupMemoryOptimizationInfo ( ) ) , resources ) ; cpuThreadsInfo = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( templates.italicFixedWidth ( "600px" , constants.clusterPopupCpuThreadsInfo ( ) ) , resources ) ; schedulerOptimizationInfoIcon = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( com.google.gwt.safehtml.shared.SafeHtmlUtils.EMPTY_SAFE_HTML , resources ) ; allowOverbookingInfoIcon = new org.ovirt.engine.ui.common.widget.dialog.InfoIcon ( com.google.gwt.safehtml.shared.SafeHtmlUtils.EMPTY_SAFE_HTML , resources ) ; }
Source:
public java.lang.String getWelcomePageSectionTemplate ( ) { java.lang.String result = "" ; try { final java.lang.String templateFileName = ( ( filePath ) + "/" ) + ( brandingProperties.getProperty ( org.ovirt.engine.core.branding.BrandingTheme.TEMPLATE_KEY ) ) ; result = readWelcomeTemplateFile ( templateFileName ) ; } catch ( java.io.IOException ioe ) { org.ovirt.engine.core.branding.BrandingTheme.log.error ( "Unable to load welcome template" , ioe ) ; } catch ( java.lang.NullPointerException e ) { org.ovirt.engine.core.branding.BrandingTheme.log.error ( "Unable to locate welcome template key in branding properties" , e ) ; } return result ; }

Target:
public java.lang.String getWelcomePageSectionTemplate ( ) { java.lang.String result = "" ; try { final java.lang.String templateFileName = ( ( filePath ) + "/" ) + ( brandingProperties.getProperty ( org.ovirt.engine.core.branding.BrandingTheme.TEMPLATE_KEY ) ) ; result = readTemplateFile ( templateFileName ) ; } catch ( java.io.IOException ioe ) { org.ovirt.engine.core.branding.BrandingTheme.log.error ( "Unable to load welcome template" , ioe ) ; } catch ( java.lang.NullPointerException e ) { org.ovirt.engine.core.branding.BrandingTheme.log.error ( "Unable to locate welcome template key in branding properties" , e ) ; } return result ; }
Source:
private static void addPermission ( org.ovirt.engine.core.compat.Guid userId , org.ovirt.engine.core.compat.Guid entityId , org.ovirt.engine.core.bll.PredefinedRoles role , org.ovirt.engine.core.common.VdcObjectType objectType ) { org.ovirt.engine.core.common.businessentities.permissions perms = new org.ovirt.engine.core.common.businessentities.permissions ( ) ; perms.setad_element_id ( userId ) ; perms.setObjectType ( objectType ) ; perms.setObjectId ( entityId ) ; perms.setrole_id ( role.getId ( ) ) ; org.ovirt.engine.core.bll.MultiLevelAdministrationHandler.addPermission ( perms ) ; }

Target:
private static void addPermission ( org.ovirt.engine.core.compat.Guid userId , org.ovirt.engine.core.compat.Guid entityId , org.ovirt.engine.core.bll.PredefinedRoles role , org.ovirt.engine.core.common.VdcObjectType objectType ) { org.ovirt.engine.core.common.businessentities.Permissions perms = new org.ovirt.engine.core.common.businessentities.Permissions ( ) ; perms.setad_element_id ( userId ) ; perms.setObjectType ( objectType ) ; perms.setObjectId ( entityId ) ; perms.setrole_id ( role.getId ( ) ) ; org.ovirt.engine.core.bll.MultiLevelAdministrationHandler.addPermission ( perms ) ; }
Source:
protected org.ovirt.engine.api.model.Storage postPopulate ( org.ovirt.engine.api.model.Storage from ) { from.setType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.StorageType.class ) . value ( ) ) ; from.setVolumeGroup ( new org.ovirt.engine.api.model.VolumeGroup ( ) ) ; from.getVolumeGroup ( ) . setId ( from.getId ( ) ) ; return from ; }

Target:
protected org.ovirt.engine.api.model.HostStorage postPopulate ( org.ovirt.engine.api.model.HostStorage from ) { from.setType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.StorageType.class ) . value ( ) ) ; from.setVolumeGroup ( new org.ovirt.engine.api.model.VolumeGroup ( ) ) ; from.getVolumeGroup ( ) . setId ( from.getId ( ) ) ; return from ; }
Source:
public void hostProviderTypeMatches ( ) { org.mockito.Mockito.when ( host.getHostProviderId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.ovirt.engine.core.common.businessentities.Provider provider = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.Provider.class ) ; org.mockito.Mockito.when ( provider.getType ( ) ) . thenReturn ( ProviderType.FOREMAN ) ; org.mockito.Mockito.when ( providerDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( provider ) ; org.junit.Assert.assertThat ( validator.hostProviderTypeMatches ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void hostProviderTypeMatches ( ) { org.mockito.Mockito.when ( host.getHostProviderId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.ovirt.engine.core.common.businessentities.Provider provider = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.Provider.class ) ; org.mockito.Mockito.when ( provider.getType ( ) ) . thenReturn ( ProviderType.FOREMAN ) ; org.mockito.Mockito.when ( providerDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( provider ) ; org.hamcrest.MatcherAssert.assertThat ( validator.hostProviderTypeMatches ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
public void getGlusterHostsNewlyAdded ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId , boolean isFingerprintRequired ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAddedGlusterServers , new org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters ( clusterId , isFingerprintRequired ) , aQuery ) ; }

Target:
public void getDataCenterById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStoragePoolById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) . withoutRefresh ( ) , aQuery ) ; }
Source:
public void extractRemovedNetwork ( ) { org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( new org.ovirt.engine.core.common.action.SetupNetworksParameters ( ) ) ; helper.extractRemoveNetworks ( new java.util.HashSet < java.lang.String > ( java.util.Arrays.asList ( "red" ) ) , java.util.Arrays.asList ( "blue" ) ) ; junit.framework.Assert.assertTrue ( helper.getRemoveNetworks ( ) . get ( 0 ) . equals ( "blue" ) ) ; }

Target:
private void assertNetworkRemoved ( org.ovirt.engine.core.bll.SetupNetworksHelper helper , java.lang.String expectedNetworkName ) { junit.framework.Assert.assertTrue ( java.text.MessageFormat.format ( "Expected network ''{0}'' to be removed but it wasn''t. Removed networks: {1}" , expectedNetworkName , helper.getRemoveNetworks ( ) ) , helper.getRemoveNetworks ( ) . contains ( expectedNetworkName ) ) ; }
Source:
public void testValidateAndSetClusterQuotaForVCPUGlobalInGrace ( ) throws java.lang.Exception { org.junit.Assert.assertTrue ( quotaManager.validateAndSetClusterQuota ( storage_pool , org.ovirt.engine.core.bll.quota.QuotaManagerTest.DESTINATION_GUID , org.ovirt.engine.core.bll.quota.QuotaManagerTest.VCPU_QUOTA_GLOBAL_IN_GRACE , 1 , 1 , canDoActionMessages ) ) ; assertEmptyCanDoActionMessage ( ) ; assertAuditLogWritten ( ) ; }

Target:
private boolean consumeForVdsQuota ( org.ovirt.engine.core.compat.Guid quotaId ) { org.ovirt.engine.core.bll.quota.QuotaConsumptionParametersWrapper parameters = null ; try { parameters = parametersWrapper.clone ( ) ; parameters.getParameters ( ) . add ( new org.ovirt.engine.core.bll.quota.QuotaVdsGroupConsumptionParameter ( quotaId , null , QuotaConsumptionParameter.QuotaAction.CONSUME , org.ovirt.engine.core.bll.quota.QuotaManagerTest.DESTINATION_GUID , 1 , 1 ) ) ; } catch ( java.lang.CloneNotSupportedException e ) { } return quotaManager.consume ( parameters ) ; }
Source:
private void updateDirectLunDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { if ( ( getDiskStorageType ( ) . getEntity ( ) ) != ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.LUN ) ) { return ; } boolean isDirectLUNDiskkEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.DirectLUNDiskEnabled , datacenter.getCompatibilityVersion ( ) . getValue ( ) ) ) ) ; getIsDirectLunDiskAvaialable ( ) . setEntity ( isDirectLUNDiskkEnabled ) ; setMessage ( ( ! isDirectLUNDiskkEnabled ? org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.directLUNDiskNotSupported ( ) : "" ) ) ; }

Target:
private void updateDirectLunDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { if ( ( getDiskStorageType ( ) . getEntity ( ) ) != ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.LUN ) ) { return ; } boolean isDirectLUNDiskkEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.DirectLUNDiskEnabled , datacenter.getCompatibilityVersion ( ) . getValue ( ) ) ) ) ; getIsDirectLunDiskAvaialable ( ) . setEntity ( isDirectLUNDiskkEnabled ) ; setMessage ( ( ! isDirectLUNDiskkEnabled ? org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.directLUNDiskNotSupported ( ) : "" ) ) ; getIsModelDisabled ( ) . setEntity ( ( ! isDirectLUNDiskkEnabled ) ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.network.VnicProfile > getAllForNetwork ( org.ovirt.engine.core.compat.Guid networkId , org.ovirt.engine.core.compat.Guid userID , boolean isFiltered ) { return getCallsHandler ( ) . executeReadList ( "GetAllVnicProfilesByNetworkId" , org.ovirt.engine.core.dao.network.VnicProfileDaoDbFacadeImpl.VnicProfileRowMapper.INSTANCE , getCustomMapSqlParameterSource ( ) . addValue ( "network_id" , networkId ) . addValue ( "user_id" , userID ) . addValue ( "is_filtered" , isFiltered ) ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.network.VnicProfile > getAllForNetwork ( org.ovirt.engine.core.compat.Guid networkId ) { return getCallsHandler ( ) . executeReadList ( "GetVnicProfilesByNetworkId" , org.ovirt.engine.core.dao.network.VnicProfileDaoDbFacadeImpl.VnicProfileRowMapper.INSTANCE , getCustomMapSqlParameterSource ( ) . addValue ( "network_id" , networkId ) ) ; }
Source:
public boolean isValid ( java.lang.String cidr , javax.validation.ConstraintValidatorContext context ) { if ( ! ( isCidrFormatValid ( cidr ) ) ) { return failWith ( context , VdcBllMessages.BAD_CIDR_FORMAT.name ( ) ) ; } if ( ! ( isCidrNetworkAddressValid ( cidr ) ) ) { return failWith ( context , VdcBllMessages.CIDR_NOT_NETWORK_ADDRESS.name ( ) ) ; } return true ; }

Target:
public boolean isValid ( java.lang.String cidr , javax.validation.ConstraintValidatorContext context ) { if ( ! ( isCidrFormatValid ( cidr ) ) ) { return failWith ( context , EngineMessage.BAD_CIDR_FORMAT.name ( ) ) ; } if ( ! ( isCidrNetworkAddressValid ( cidr ) ) ) { return failWith ( context , EngineMessage.CIDR_NOT_NETWORK_ADDRESS.name ( ) ) ; } return true ; }
Source:
public void freeMacs ( java.util.List < java.lang.String > macs ) { org.ovirt.engine.core.bll.MacPoolManager.log.info ( "MacPoolManager::freeMacs - entered" ) ; mLocObj.writeLock ( ) . lock ( ) ; try { if ( ! ( mInitialized ) ) { throw new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.MAC_POOL_NOT_INITIALIZED ) ; } for ( java.lang.String mac : macs ) { internalFreeLock ( mac ) ; } } finally { mLocObj.writeLock ( ) . unlock ( ) ; } }

Target:
public void freeMacs ( java.util.List < java.lang.String > macs ) { org.ovirt.engine.core.bll.MacPoolManager.log.info ( "MacPoolManager::freeMacs - entered" ) ; mLocObj.writeLock ( ) . lock ( ) ; try { if ( ! ( mInitialized ) ) { logInitializationError ( "Failed to free MAC addresses." ) ; } for ( java.lang.String mac : macs ) { internalFreeMac ( mac ) ; } } finally { mLocObj.writeLock ( ) . unlock ( ) ; } }
Source:
public static java.lang.String getTimezoneIndexByKey ( java.lang.String key ) { for ( java.util.Map.Entry < java.lang.String , java.lang.Integer > timeZoneEntry : org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.timeZoneIndex.entrySet ( ) ) { if ( org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.getTimezoneKey ( timeZoneEntry.getKey ( ) ) . equals ( key ) ) { return timeZoneEntry.getValue ( ) . toString ( ) ; } } org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.log.errorFormat ( "getTimezoneIndexByKey: cannot find timezone key '{0}'" , key ) ; return key ; }

Target:
public static java.lang.String getTimezoneIndexByKey ( java.lang.String key ) { for ( java.util.Map.Entry < java.lang.String , java.lang.Integer > timeZoneEntry : org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.timeZoneIndex.entrySet ( ) ) { if ( org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.getTimezoneKey ( timeZoneEntry.getKey ( ) ) . equals ( key ) ) { return timeZoneEntry.getValue ( ) . toString ( ) ; } } org.ovirt.engine.core.vdsbroker.vdsbroker.SysprepHandler.log.error ( "getTimezoneIndexByKey: cannot find timezone key '{}'" , key ) ; return key ; }
Source:
public void getGlusterSwiftServices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid serverId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterServerServicesByServerId , new org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters ( serverId , org.ovirt.engine.core.common.businessentities.gluster.ServiceType.GLUSTER_SWIFT ) , aQuery ) ; }

Target:
public void getGlusterHookContent ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hookId , org.ovirt.engine.core.compat.Guid serverId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : "" ; } } ; org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters parameters = new org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters ( hookId ) ; parameters.setGlusterServerId ( serverId ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterHookContent , parameters , aQuery ) ; }
Source:
public org.ovirt.engine.ui.uicommonweb.UiAction getCommitNetworkChangesAction ( ) { return new org.ovirt.engine.ui.uicommonweb.UiVdcAction ( org.ovirt.engine.core.common.action.VdcActionType.CommitNetworkChanges , new org.ovirt.engine.core.common.action.VdsActionParameters ( getEntity ( ) . getId ( ) ) , this , true ) { @ java.lang.Override protected boolean shouldExecute ( ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel < java.lang.Boolean > commitChanges = org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel.this . getCommitChanges ( ) ; return commitChanges.getEntity ( ) ; } } ; }

Target:
public org.ovirt.engine.ui.uicommonweb.action.UiAction getCommitNetworkChangesAction ( ) { return new org.ovirt.engine.ui.uicommonweb.action.UiVdcAction ( org.ovirt.engine.core.common.action.VdcActionType.CommitNetworkChanges , new org.ovirt.engine.core.common.action.VdsActionParameters ( getEntity ( ) . getId ( ) ) , this , true ) { @ java.lang.Override protected boolean shouldExecute ( ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel < java.lang.Boolean > commitChanges = org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel.this . getCommitChanges ( ) ; return commitChanges.getEntity ( ) ; } } ; }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.EngineSession > searchSessions ( ) { return genericSearch ( org.ovirt.engine.core.bll.SearchQuery.getDbFacade ( ) . getEngineSessionDao ( ) , false ) ; }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.UserSession > searchSessions ( ) { final java.util.List < org.ovirt.engine.core.common.businessentities.EngineSession > engineSessions = genericSearch ( org.ovirt.engine.core.bll.SearchQuery.getDbFacade ( ) . getEngineSessionDao ( ) , false ) ; return org.ovirt.engine.core.utils.linq.LinqUtils.transformToList ( engineSessions , new org.ovirt.engine.core.utils.linq.Function < org.ovirt.engine.core.common.businessentities.EngineSession , org.ovirt.engine.core.common.businessentities.UserSession > ( ) { @ java.lang.Override public org.ovirt.engine.core.common.businessentities.UserSession eval ( org.ovirt.engine.core.common.businessentities.EngineSession engineSession ) { return new org.ovirt.engine.core.common.businessentities.UserSession ( engineSession ) ; } } ) ; }
Source:
public void getCPUList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Version version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllServerCpuList , new org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters ( version ) , aQuery ) ; }

Target:
public void getCPUList ( org.ovirt.engine.ui.frontend.AsyncQuery < java.util.List < org.ovirt.engine.core.common.businessentities.ServerCpu > > aQuery , org.ovirt.engine.core.compat.Version version ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.ListConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllServerCpuList , new org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters ( version ) , aQuery ) ; }
Source:
public javax.ws.rs.core.Response CancelVm ( org.ovirt.optimizer.service.facts.RunningVm request , @ javax.ws.rs.PathParam ( value = "cluster" ) java.lang.String cluster ) { optimizer.cancelVmStart ( cluster , request.getId ( ) ) ; return javax.ws.rs.core.Response.ok ( ) . header ( "Access-Control-Allow-Origin" , "*" ) . header ( "Access-Control-Allow-Methods" , "POST" ) . header ( "Access-Control-Allow-Headers" , "Content-Type" ) . build ( ) ; }

Target:
public javax.ws.rs.core.Response cancelVm ( org.ovirt.optimizer.service.facts.RunningVm request , @ javax.ws.rs.PathParam ( value = "cluster" ) java.lang.String cluster ) { optimizer.cancelVmStart ( cluster , request.getId ( ) ) ; return javax.ws.rs.core.Response.ok ( ) . header ( "Access-Control-Allow-Origin" , "*" ) . header ( "Access-Control-Allow-Methods" , "POST" ) . header ( "Access-Control-Allow-Headers" , "Content-Type" ) . build ( ) ; }
Source:
public < T > T findResource ( org.ovirt.engine.core.utils.ejb.ContainerManagedResourceType resourceValue ) { java.lang.String jndiNameFromMap = getResourceJNDIName ( resourceValue ) ; if ( jndiNameFromMap == null ) { org.ovirt.engine.core.utils.ejb.EJBUtilsStrategy.log.error ( ( "No JNDI name for : " + resourceValue ) ) ; return null ; } try { return getReference ( jndiNameFromMap ) ; } catch ( javax.naming.NamingException ex ) { org.ovirt.engine.core.utils.ejb.EJBUtilsStrategy.log.error ( ( "Error looking up resource " + resourceValue ) ) ; return null ; } }

Target:
public < T > T findResource ( org.ovirt.engine.core.utils.ejb.ContainerManagedResourceType resourceValue ) { java.lang.String jndiNameFromMap = getResourceJNDIName ( resourceValue ) ; if ( jndiNameFromMap == null ) { org.ovirt.engine.core.utils.ejb.EJBUtilsStrategy.log.error ( "No JNDI name for '{}'" , resourceValue ) ; return null ; } try { return getReference ( jndiNameFromMap ) ; } catch ( javax.naming.NamingException ex ) { org.ovirt.engine.core.utils.ejb.EJBUtilsStrategy.log.error ( "Error looking up resource '{}'" , resourceValue ) ; return null ; } }
Source:
protected boolean expectBlocking ( ) { boolean expectBlocking = false ; java.util.List < java.lang.String > expect = httpHeaders.getRequestHeader ( org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResource.EXPECT_HEADER ) ; if ( ( expect != null ) && ( ( expect.size ( ) ) > 0 ) ) { expectBlocking = expect.get ( 0 ) . equalsIgnoreCase ( org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResource.BLOCKING_EXPECTATION ) ; } return expectBlocking ; }

Target:
protected boolean expectBlocking ( ) { java.util.Set < java.lang.String > expectations = org.ovirt.engine.api.utils.ExpectationHelper.getExpectations ( httpHeaders ) ; return expectations.contains ( org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResource.BLOCKING_EXPECTATION ) ; }
Source:
public void setSearchPanel ( com.google.gwt.user.client.ui.IsWidget searchPanel ) { searchFormGroup.clear ( ) ; if ( searchPanel != null ) { searchFormGroup.add ( searchPanel ) ; actionFormGroup.removeStyleName ( Styles.ROW ) ; } }

Target:
public void setSearchPanel ( com.google.gwt.user.client.ui.IsWidget searchPanel ) { if ( searchPanel == null ) { if ( ( searchFormGroup ) != null ) { actionContainer.remove ( searchFormGroup ) ; searchFormGroup = null ; } } else { if ( ( searchFormGroup ) != null ) { searchFormGroup.clear ( ) ; } else { searchFormGroup = new org.gwtbootstrap3.client.ui.FormGroup ( ) ; searchFormGroup.addStyleName ( PatternflyConstants.PF_TOOLBAR_FILTER ) ; actionContainer.insert ( searchFormGroup , 0 ) ; } searchFormGroup.add ( searchPanel ) ; actionFormGroup.removeStyleName ( Styles.ROW ) ; } }
Source:
public void externalNetworkAttached ( ) { org.ovirt.engine.core.common.businessentities.network.Network net = createNetwork ( "net" ) ; net.setProvidedBy ( new org.ovirt.engine.core.common.businessentities.network.ProviderNetwork ( ) ) ; mockExistingNetworks ( net ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNic ( "nic0" , null ) ; mockExistingIfaces ( nic ) ; nic.setNetworkName ( net.getName ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic ) ) ; validateAndExpectViolation ( helper , VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_NETWORKS_CANNOT_BE_PROVISIONED ) ; }

Target:
public void externalNetworkAttached ( ) { org.ovirt.engine.core.common.businessentities.network.Network net = createNetwork ( "net" ) ; net.setProvidedBy ( new org.ovirt.engine.core.common.businessentities.network.ProviderNetwork ( ) ) ; mockExistingNetworks ( net ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNic ( "nic0" , null ) ; mockExistingIfaces ( nic ) ; nic.setNetworkName ( net.getName ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic ) ) ; validateAndExpectViolation ( helper , EngineMessage.ACTION_TYPE_FAILED_EXTERNAL_NETWORKS_CANNOT_BE_PROVISIONED ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getDbUserDao ( ) ; vm = new org.ovirt.engine.core.compat.Guid ( "77296e00-0cad-4e5a-9299-008a7b6f4354" ) ; existingUser = dao.get ( new org.ovirt.engine.core.compat.Guid ( "9bf7c640-b620-456f-a550-0348f366544a" ) ) ; deletableUser = dao.get ( new org.ovirt.engine.core.compat.Guid ( "9bf7c640-b620-456f-a550-0348f366544b" ) ) ; newUser = new org.ovirt.engine.core.common.businessentities.aaa.DbUser ( ) ; newUser.setExternalId ( "0" ) ; newUser.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; newUser.setFirstName ( "Bob" ) ; newUser.setLastName ( "Milqtoste" ) ; newUser.setLoginName ( "newuser" ) ; newUser.setEmail ( "newuser@redhat.com" ) ; newUser.setDomain ( "domain" ) ; newUser.setGroupNames ( new java.util.HashSet < java.lang.String > ( java.util.Arrays.asList ( "groups" ) ) ) ; newUser.setNamespace ( "*" ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getDbUserDao ( ) ; vm = new org.ovirt.engine.core.compat.Guid ( "77296e00-0cad-4e5a-9299-008a7b6f4354" ) ; existingUser = dao.get ( new org.ovirt.engine.core.compat.Guid ( "9bf7c640-b620-456f-a550-0348f366544a" ) ) ; deletableUser = dao.get ( new org.ovirt.engine.core.compat.Guid ( "9bf7c640-b620-456f-a550-0348f366544b" ) ) ; newUser = new org.ovirt.engine.core.common.businessentities.aaa.DbUser ( ) ; newUser.setExternalId ( "0" ) ; newUser.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; newUser.setFirstName ( "Bob" ) ; newUser.setLastName ( "Milqtoste" ) ; newUser.setLoginName ( "newuser" ) ; newUser.setEmail ( "newuser@redhat.com" ) ; newUser.setDomain ( "domain" ) ; newUser.setGroupNames ( new java.util.LinkedList < java.lang.String > ( java.util.Arrays.asList ( "groups" ) ) ) ; newUser.setNamespace ( "*" ) ; }
Source:
public boolean eval ( org.ovirt.engine.core.common.businessentities.VDS p ) { return ( ( ( p.getUsageCpuPercent ( ) ) <= ( p.getLowUtilization ( ) ) ) && ( ( p.getCpuOverCommitTimestamp ( ) ) != null ) ) && ( ( ( new java.util.Date ( ) . getTime ( ) ) - ( p.getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) >= ( ( ( p.getCpuOverCommitDurationMinutes ( ) ) * 60 ) * 1000 ) ) ; }

Target:
public boolean eval ( org.ovirt.engine.core.common.businessentities.VDS p ) { return ( ( ( p.getUsageCpuPercent ( ) ) <= ( p.getLowUtilization ( ) ) ) && ( ( p.getCpuOverCommitTimestamp ( ) ) != null ) ) && ( ( ( new java.util.Date ( ) . getTime ( ) ) - ( p.getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) >= ( ( ( ( long ) ( p.getCpuOverCommitDurationMinutes ( ) ) ) * 60L ) * 1000L ) ) ; }
Source:
public void testGetAllAfterDate ( ) throws java.lang.Exception { java.util.Date cutoff = EXPECTED_DATE_FORMAT.parse ( "2010-12-20 13:00:00" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.AuditLog > result = dao.getAllAfterDate ( cutoff ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.AuditLogDAOTest.FILTERED_COUNT , result.size ( ) ) ; cutoff = EXPECTED_DATE_FORMAT.parse ( "2010-12-20 14:00:00" ) ; result = dao.getAllAfterDate ( cutoff ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( 0 , result.size ( ) ) ; }

Target:
public void testGetAllAfterDate ( ) throws java.lang.Exception { java.util.Date cutoff = org.ovirt.engine.core.dao.AuditLogDAOTest.EXPECTED_DATE_FORMAT.parse ( "2010-12-20 13:00:00" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.AuditLog > result = dao.getAllAfterDate ( cutoff ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.AuditLogDAOTest.FILTERED_COUNT , result.size ( ) ) ; cutoff = org.ovirt.engine.core.dao.AuditLogDAOTest.EXPECTED_DATE_FORMAT.parse ( "2010-12-20 14:00:00" ) ; result = dao.getAllAfterDate ( cutoff ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( 0 , result.size ( ) ) ; }
Source:
private void totalCPUCores_EntityChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { getNumOfSockets ( ) . getSelectedItemChangedEvent ( ) . removeListener ( this ) ; getTotalCPUCores ( ) . getEntityChangedEvent ( ) . removeListener ( this ) ; getCoresPerSocket ( ) . getSelectedItemChangedEvent ( ) . removeListener ( this ) ; behavior.totalCpuCoresChanged ( ) ; getTotalCPUCores ( ) . getEntityChangedEvent ( ) . addListener ( this ) ; getNumOfSockets ( ) . getSelectedItemChangedEvent ( ) . addListener ( this ) ; getCoresPerSocket ( ) . getSelectedItemChangedEvent ( ) . addListener ( this ) ; }

Target:
private void totalCPUCores_EntityChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { removeCPUListeners ( ) ; behavior.totalCpuCoresChanged ( ) ; addCPUListeners ( ) ; }
Source:
public java.lang.String getTemplate ( ) { return this . template ; }

Target:
public java.lang.String evaluate ( ) { java.lang.String text = template ; for ( java.util.Map.Entry < java.lang.String , java.lang.Object > variable : variables.entrySet ( ) ) { java.lang.String key = ( ( KEY_WRAP ) + ( variable.getKey ( ) ) ) + ( KEY_WRAP ) ; java.lang.Object value = variable.getValue ( ) ; if ( value != null ) { text = text.replace ( key , value.toString ( ) ) ; } } return text ; }
Source:
public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel object ) { org.ovirt.engine.core.common.businessentities.LunDisk disk = ( ( org.ovirt.engine.core.common.businessentities.LunDisk ) ( ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( object.getEntity ( ) ) ) . getDisk ( ) ) ) ; return disk.getLun ( ) . getProductId ( ) ; }

Target:
public com.google.gwt.safehtml.shared.SafeHtml getTooltip ( org.ovirt.engine.ui.uicommonweb.models.EntityModel object ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( object.getEntity ( ) ) ) . getDisk ( ) ; if ( disk.isBoot ( ) ) { return com.google.gwt.safehtml.shared.SafeHtmlUtils.fromSafeConstant ( constants.bootableDisk ( ) ) ; } return null ; }
Source:
public void testCanDoActionVmUp ( ) { prepareForVmValidatorTests ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . isDiskPlugged ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN ) ; }

Target:
public void testCanDoActionVmUpLiveMergeNotSupported ( ) { prepareForVmValidatorTests ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . isDiskPlugged ( ) ; org.mockito.Mockito.doReturn ( false ) . when ( cmd ) . isLiveMergeSupported ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN ) ; }
Source:
private void setUpGetCertuficateExpectations ( int times ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsCertificateSubjectByVmId , org.ovirt.engine.core.common.queries.GetVmByVmIdParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ i ] } , org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.CERTIFICATE ) ; } }

Target:
private void setUpGetCertuficateExpectations ( int times , int index ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsCertificateSubjectByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ index ] } , org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.CERTIFICATE ) ; } }