auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.Tags tag = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getTagDao ( ) . getByName ( org.ovirt.engine.core.bll.AddTagCommand.getParameters ( ) . getTag ( ) . gettag_name ( ) ) ; if ( tag != null ) { addCanDoActionMessage ( EngineMessage.TAGS_SPECIFY_TAG_IS_IN_USE ) ; return false ; } return true ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.Tags tag = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getTagDao ( ) . getByName ( org.ovirt.engine.core.bll.AddTagCommand.getParameters ( ) . getTag ( ) . getTagName ( ) ) ; if ( tag != null ) { addCanDoActionMessage ( EngineMessage.TAGS_SPECIFY_TAG_IS_IN_USE ) ; return false ; } return true ; }
Source:
private void setHasSearchStringPrefix ( boolean value ) { if ( ( hasSearchStringPrefix ) != value ) { hasSearchStringPrefix = value ; OnPropertyChanged ( new org.ovirt.engine.core.compat.PropertyChangedEventArgs ( "HasSearchStringPrefix" ) ) ; } }

Target:
public void setSearchString ( java.lang.String value , boolean checkIfNewValue ) { if ( ( ! checkIfNewValue ) || ( ! ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( searchString , value ) ) ) ) { searchString = value ; searchStringChanged ( ) ; onPropertyChanged ( new org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ( "SearchString" ) ) ; } }
Source:
public org.ovirt.engine.ui.uicommonweb.models.userportal.ConsoleProtocol resolveSelectedProtocol ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalItemModel item ) { org.ovirt.engine.core.compat.Guid vmId = ( ( item.getEntity ( ) ) instanceof org.ovirt.engine.core.common.businessentities.VM ) ? ( ( org.ovirt.engine.core.common.businessentities.VM ) ( item.getEntity ( ) ) ) . getId ( ) : null ; if ( vmId == null ) { return null ; } for ( org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel model : cachedConsoleModels.get ( vmId ) ) { if ( model.isUserSelected ( ) ) { return org.ovirt.engine.ui.uicommonweb.models.userportal.ConsoleProtocol.getProtocolByModel ( model.getClass ( ) ) ; } } return null ; }

Target:
private org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel resolveSelectedConsoleModel ( org.ovirt.engine.core.compat.Guid vmId ) { for ( org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel model : cachedConsoleModels.get ( vmId ) ) { if ( model.isUserSelected ( ) ) { return model ; } } return null ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult networksAreAttachedToThisInterface ( java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > hostInterfaces , java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > clusterNetworksWithLabel ) { java.util.List < java.lang.String > assignedNetworks = validateNetworksNotAssignedToIncorrectNics ( hostInterfaces , clusterNetworksWithLabel ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( VdcBllMessages.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE , ( "$AssignedNetworks " + ( org.apache.commons.lang.StringUtils.join ( assignedNetworks , ", " ) ) ) ) . when ( ( ! ( assignedNetworks.isEmpty ( ) ) ) ) ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult networksAreAttachedToThisInterface ( java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > hostInterfaces , java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > clusterNetworksWithLabel ) { java.util.List < java.lang.String > assignedNetworks = validateNetworksNotAssignedToIncorrectNics ( hostInterfaces , clusterNetworksWithLabel ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( EngineMessage.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE , ( "$AssignedNetworks " + ( org.apache.commons.lang.StringUtils.join ( assignedNetworks , ", " ) ) ) ) . when ( ( ! ( assignedNetworks.isEmpty ( ) ) ) ) ; }
Source:
public void canDoActionSucceeds ( ) throws java.lang.Exception { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.RemoveVdsCommand < org.ovirt.engine.core.common.action.RemoveVdsParameters > ( new org.ovirt.engine.core.common.action.RemoveVdsParameters ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , false ) ) ) ; prepareMocks ( ) ; mockVdsWithStatus ( VDSStatus.Maintenance ) ; mockVdsDynamic ( ) ; mockVmsPinnedToHost ( java.util.Collections.< java.lang.String > emptyList ( ) ) ; mockIsGlusterEnabled ( false ) ; mockHasVolumeOnServer ( false ) ; runAndAssertCanDoActionSuccess ( ) ; }

Target:
public void canDoActionSucceeds ( ) throws java.lang.Exception { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.RemoveVdsCommand < org.ovirt.engine.core.common.action.RemoveVdsParameters > ( new org.ovirt.engine.core.common.action.RemoveVdsParameters ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , false ) ) ) ; prepareMocks ( ) ; mockVdsWithStatus ( VDSStatus.Maintenance ) ; mockVdsDynamic ( ) ; mockVmsPinnedToHost ( java.util.Collections.< java.lang.String > emptyList ( ) ) ; mockIsGlusterEnabled ( false ) ; mockHasVolumeOnServer ( false ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( command ) ; }
Source:
public void virtIoRngNotSupported ( ) { org.mockito.Mockito.when ( cluster.getRequiredRngSources ( ) ) . thenReturn ( java.util.Collections.singleton ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextEnum ( org.ovirt.engine.core.common.businessentities.VmRngDevice.Source.class ) ) ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ClusterValidator ( dbFacade , cluster ) ) ; org.mockito.Mockito.doReturn ( false ) . when ( validator ) . virtIoRngSupportedInCluster ( ) ; org.junit.Assert.assertThat ( validator.virtIoRngSupported ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_RNG_SOURCE_NOT_SUPPORTED ) ) ; }

Target:
public void virtIoRngNotSupported ( ) { org.mockito.Mockito.when ( cluster.getRequiredRngSources ( ) ) . thenReturn ( java.util.Collections.singleton ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextEnum ( org.ovirt.engine.core.common.businessentities.VmRngDevice.Source.class ) ) ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ClusterValidator ( dbFacade , cluster ) ) ; org.mockito.Mockito.doReturn ( false ) . when ( validator ) . virtIoRngSupportedInCluster ( ) ; org.junit.Assert.assertThat ( validator.virtIoRngSupported ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_RNG_SOURCE_NOT_SUPPORTED ) ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.VM serializeAndDeserialize ( org.ovirt.engine.core.common.businessentities.VM inputVm ) throws org.ovirt.engine.core.utils.ovf.OvfReaderException { java.lang.String xml = manager.exportVm ( inputVm , new java.util.ArrayList < > ( ) , Version.v3_1 ) ; org.junit.Assert.assertNotNull ( xml ) ; final org.ovirt.engine.core.common.businessentities.VM resultVm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; org.junit.Assert.assertTrue ( xml.contains ( "Generation" ) ) ; java.lang.String replacedXml = xml.replaceAll ( "Generation" , "test_replaced" ) ; manager.importVm ( replacedXml , resultVm , new java.util.ArrayList < > ( ) , new java.util.ArrayList < > ( ) ) ; return resultVm ; }

Target:
private org.ovirt.engine.core.common.businessentities.VM serializeAndDeserialize ( org.ovirt.engine.core.common.businessentities.VM inputVm ) throws org.ovirt.engine.core.utils.ovf.OvfReaderException { java.lang.String xml = manager.exportVm ( inputVm , new java.util.ArrayList < > ( ) , Version.v3_6 ) ; org.junit.Assert.assertNotNull ( xml ) ; final org.ovirt.engine.core.common.businessentities.VM resultVm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; org.junit.Assert.assertTrue ( xml.contains ( "Generation" ) ) ; java.lang.String replacedXml = xml.replaceAll ( "Generation" , "test_replaced" ) ; manager.importVm ( replacedXml , resultVm , new java.util.ArrayList < > ( ) , new java.util.ArrayList < > ( ) ) ; return resultVm ; }
Source:
public void getSpiceUsbAutoShare ( 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 ) { return source != null ? ( ( java.lang.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SpiceUsbAutoShare , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public void getDataCenterList ( 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.StoragePool > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.Search , new org.ovirt.engine.core.common.queries.SearchParameters ( "DataCenter: sortby name" , org.ovirt.engine.core.common.interfaces.SearchType.StoragePool ) , aQuery ) ; }
Source:
protected boolean checkRemoveEditValidations ( ) { org.ovirt.engine.core.compat.Guid clusterPolicyId = getParameters ( ) . getClusterPolicyId ( ) ; if ( clusterPolicyId == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } org.ovirt.engine.core.common.scheduling.ClusterPolicy clusterPolicy = schedulingManager.getClusterPolicy ( clusterPolicyId ) ; if ( clusterPolicy == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } if ( clusterPolicy.isLocked ( ) ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } return true ; }

Target:
protected boolean checkRemoveEditValidations ( ) { org.ovirt.engine.core.compat.Guid clusterPolicyId = getParameters ( ) . getClusterPolicyId ( ) ; if ( clusterPolicyId == null ) { return failValidation ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } org.ovirt.engine.core.common.scheduling.ClusterPolicy clusterPolicy = schedulingManager.getClusterPolicy ( clusterPolicyId ) ; if ( clusterPolicy == null ) { return failValidation ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } if ( clusterPolicy.isLocked ( ) ) { return failValidation ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } return true ; }
Source:
private void engineIsRunningNotification ( ) { try { org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "DWH Heart Beat - Start" ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( TransactionScopeOption.RequiresNew , ( ) -> { heartBeatVar.setDateTime ( new java.util.Date ( ) ) ; dwhHistoryTimekeepingDao.save ( heartBeatVar ) ; return null ; } ) ; org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "DWH Heart Beat - End" ) ; } catch ( java.lang.Exception ex ) { org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.error ( "Error updating DWH Heart Beat: {}" , ex.getMessage ( ) ) ; org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "Exception" , ex ) ; } }

Target:
private void engineIsRunningNotification ( ) { try { org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "DWH Heart Beat - Start" ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( TransactionScopeOption.RequiresNew , ( ) -> { heartBeatVar.setDateTime ( new java.util.Date ( ) ) ; dwhHistoryTimekeepingDao.save ( heartBeatVar ) ; return null ; } ) ; org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "DWH Heart Beat - End" ) ; } catch ( java.lang.Throwable t ) { org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.error ( "Error updating DWH Heart Beat: {}" , org.apache.commons.lang.exception.ExceptionUtils.getRootCauseMessage ( t ) ) ; org.ovirt.engine.core.bll.dwh.DwhHeartBeat.log.debug ( "Exception" , t ) ; } }
Source:
protected org.ovirt.engine.core.bll.ValidationResult validateDisplayType ( ) { org.ovirt.engine.core.common.businessentities.DisplayType selectedDisplayType = ( ( runVmParam.getUseVnc ( ) ) == null ) ? vm.getDefaultDisplayType ( ) : runVmParam.getUseVnc ( ) ? org.ovirt.engine.core.common.businessentities.DisplayType.vga : org.ovirt.engine.core.common.businessentities.DisplayType.qxl ; if ( ! ( org.ovirt.engine.core.bll.validator.VmValidationUtils.isDisplayTypeSupported ( vm.getOs ( ) , vm.getVdsGroupCompatibilityVersion ( ) , selectedDisplayType ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
protected org.ovirt.engine.core.bll.ValidationResult validateDisplayType ( ) { if ( ! ( org.ovirt.engine.core.bll.validator.VmValidationUtils.isGraphicsAndDisplaySupported ( vm.getOs ( ) , vm.getVdsGroupCompatibilityVersion ( ) , getVmActiveGraphics ( ) , vm.getDefaultDisplayType ( ) ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterVolumeGeoRepSessionResume ( java.lang.String volumeName , java.lang.String slaveHostName , java.lang.String slaveVolumeName , boolean force ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterVolumeGeoRepSessionResume ( volumeName , slaveHostName , slaveVolumeName , force ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterGeoRepKeysUpdate ( java.util.List < java.lang.String > geoRepPubKeys , java.lang.String userName ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterGeoRepKeysUpdate ( userName , geoRepPubKeys ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
protected void setUpGetSoundcardExpectations ( int ... idxs ) throws java.lang.Exception { for ( int i = 0 ; i < ( idxs.length ) ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetSoundDevices , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ idxs [ i ] ] } , new java.util.ArrayList < > ( ) ) ; } }

Target:
protected void setUpGetSoundcardExpectations ( int ... idxs ) throws java.lang.Exception { for ( int i = 0 ; i < ( idxs.length ) ; i ++ ) { setUpGetEntityExpectations ( QueryType.GetSoundDevices , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ idxs [ i ] ] } , new java.util.ArrayList < > ( ) ) ; } }
Source:
public static void GetVmListByClusterName ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String clusterName ) { 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 ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VM > vms = org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.VM > Cast ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.IVdcQueryable > ) ( source ) ) ) ; return vms ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.Search , new org.ovirt.engine.core.common.queries.SearchParameters ( ( "Vms: cluster=" + clusterName ) , org.ovirt.engine.core.common.interfaces.SearchType.VM ) , aQuery ) ; }

Target:
public static void getPermittedStorageDomainsByStoragePoolId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId , org.ovirt.engine.core.common.businessentities.ActionGroup actionGroup ) { 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.StorageDomain > ( ) ; } return source ; } } ; org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters params = new org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters ( ) ; params.setStoragePoolId ( dataCenterId ) ; params.setActionGroup ( actionGroup ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetPermittedStorageDomainsByStoragePoolId , params , aQuery ) ; }
Source:
public java.lang.String getText ( org.ovirt.engine.core.common.businessentities.StorageDomain storage ) { if ( ( ( storage.getavailable_disk_size ( ) ) == null ) || ( ( storage.getavailable_disk_size ( ) ) < 1 ) ) { return "< 1 GB" ; } return ( storage.getavailable_disk_size ( ) ) + " GB" ; }

Target:
public java.lang.String getText ( org.ovirt.engine.core.common.businessentities.StorageDomain storage ) { if ( ( ( storage.getAvailableDiskSize ( ) ) == null ) || ( ( storage.getAvailableDiskSize ( ) ) < 1 ) ) { return "< 1 GB" ; } return ( storage.getAvailableDiskSize ( ) ) + " GB" ; }
Source:
public void getVmSnapshotList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { 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.Snapshot > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Snapshot > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllVmSnapshotsByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }

Target:
public void getIsGlusterVolumeSnapshotCliScheduleEnabled ( org.ovirt.engine.ui.frontend.AsyncQuery < java.lang.Boolean > aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.CastingConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeSnapshotCliScheduleFlag , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }
Source:
protected boolean validateSpaceRequirements ( ) { for ( java.util.Map.Entry < org.ovirt.engine.core.compat.Guid , java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > > sdImageEntry : storageToDisksMap.entrySet ( ) ) { org.ovirt.engine.core.common.businessentities.StorageDomain destStorageDomain = destStorages.get ( sdImageEntry.getKey ( ) ) ; org.ovirt.engine.core.bll.validator.StorageDomainValidator storageDomainValidator = createStorageDomainValidator ( destStorageDomain ) ; if ( ( ! ( validateDomainsThreshold ( storageDomainValidator ) ) ) || ( ! ( validateFreeSpace ( storageDomainValidator , destStorageDomain ) ) ) ) { return false ; } } return true ; }

Target:
protected boolean validateSpaceRequirements ( ) { for ( java.util.Map.Entry < org.ovirt.engine.core.compat.Guid , java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > > sdImageEntry : storageToDisksMap.entrySet ( ) ) { org.ovirt.engine.core.common.businessentities.StorageDomain destStorageDomain = destStorages.get ( sdImageEntry.getKey ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > disksList = sdImageEntry.getValue ( ) ; org.ovirt.engine.core.bll.validator.StorageDomainValidator storageDomainValidator = createStorageDomainValidator ( destStorageDomain ) ; if ( ( ! ( validateDomainsThreshold ( storageDomainValidator ) ) ) || ( ! ( validateFreeSpace ( storageDomainValidator , disksList ) ) ) ) { return false ; } } return true ; }
Source:
public static org.ovirt.engine.core.common.businessentities.VmDevice addSoundDevice ( org.ovirt.engine.core.compat.Guid vmId , int osId , org.ovirt.engine.core.compat.Version compatibilityVersion ) { java.lang.String soundDevice = org.ovirt.engine.core.bll.utils.VmDeviceUtils.osRepository.getSoundDevice ( osId , compatibilityVersion ) ; return org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , vmId ) , VmDeviceGeneralType.SOUND , org.ovirt.engine.core.common.utils.VmDeviceType.getSoundDeviceType ( soundDevice ) , org.ovirt.engine.core.bll.utils.VmDeviceUtils.EMPTY_SPEC_PARAMS , true , true ) ; }

Target:
public org.ovirt.engine.core.common.businessentities.VmDevice addSoundDevice ( org.ovirt.engine.core.compat.Guid vmId , int osId , org.ovirt.engine.core.compat.Version compatibilityVersion ) { java.lang.String soundDevice = osRepository.getSoundDevice ( osId , compatibilityVersion ) ; return addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , vmId ) , VmDeviceGeneralType.SOUND , org.ovirt.engine.core.common.utils.VmDeviceType.getSoundDeviceType ( soundDevice ) , org.ovirt.engine.core.bll.utils.VmDeviceUtils.EMPTY_SPEC_PARAMS , true , true ) ; }
Source:
private void updateKeyTitle ( org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueLineModel object ) { java.lang.String selectedKey = ( ( java.lang.String ) ( object.getKeys ( ) . getSelectedItem ( ) ) ) ; if ( selectedKey == null ) { selectedKey = "" ; } keyField.getElement ( ) . setTitle ( selectedKey ) ; }

Target:
private void updateKeyTitle ( org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueLineModel object ) { java.lang.String selectedKey = ( ( java.lang.String ) ( object.getKeys ( ) . getSelectedItem ( ) ) ) ; if ( selectedKey != null ) { org.ovirt.engine.ui.common.widget.tooltip.TooltipMixin.addTooltipToElement ( com.google.gwt.safehtml.shared.SafeHtmlUtils.fromString ( selectedKey ) , keyField.getElement ( ) ) ; } }
Source:
public void testRemove ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpQueryExpectations ( "" , null , StorageDomainType.ImportExport ) ; setUpGetDataCenterByStorageDomainExpectations ( GUIDS [ 3 ] , 2 ) ; java.lang.String [ ] names = new java.lang.String [ ] { "VmId" , "StorageDomainId" , "StoragePoolId" } ; java.lang.Object [ ] values = new java.lang.Object [ ] { GUIDS [ 1 ] , GUIDS [ 3 ] , org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmResourceTest.DATA_CENTER_ID } ; setUpActionExpectations ( VdcActionType.RemoveVmFromImportExport , org.ovirt.engine.core.common.action.RemoveVmFromImportExportParameters.class , names , values , true , true ) ; verifyRemove ( resource.remove ( ) ) ; }

Target:
public void testRemove ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpQueryExpectations ( "" , null , StorageDomainType.ImportExport ) ; setUpGetDataCenterByStorageDomainExpectations ( GUIDS [ 3 ] , 2 ) ; java.lang.String [ ] names = new java.lang.String [ ] { "VmId" , "StorageDomainId" , "StoragePoolId" } ; java.lang.Object [ ] values = new java.lang.Object [ ] { GUIDS [ 1 ] , GUIDS [ 3 ] , org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmResourceTest.DATA_CENTER_ID } ; setUpActionExpectations ( ActionType.RemoveVmFromImportExport , org.ovirt.engine.core.common.action.RemoveVmFromImportExportParameters.class , names , values , true , true ) ; verifyRemove ( resource.remove ( ) ) ; }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnRemove" ) ) { OnRemove ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnRestore" ) ) { OnRestore ( ) ; } else { super . executeCommand ( command ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnRemove" ) ) { onRemove ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnRestore" ) ) { onRestore ( ) ; } else { super . executeCommand ( command ) ; } }
Source:
protected void openDocumentation ( T model ) { java.lang.String helpTag = model.getHelpTag ( ) . name ; java.lang.String documentationPath = org.ovirt.engine.ui.common.uicommon.DocumentationPathTranslator.getPath ( helpTag ) ; java.lang.String documentationLibURL = model.getConfigurator ( ) . getDocumentationLibURL ( ) ; org.ovirt.engine.ui.common.utils.WebUtils.openUrlInNewWindow ( "_blank" , ( documentationLibURL + documentationPath ) , WebUtils.OPTION_SCROLLBARS ) ; }

Target:
protected void openDocumentation ( T model ) { java.lang.String helpTag = model.getHelpTag ( ) . name ; java.lang.String docPath = org.ovirt.engine.ui.common.uicommon.ContextSensitiveHelpManager.getPath ( helpTag ) ; java.lang.String docBase = model.getConfigurator ( ) . getDocsBaseUrl ( ) ; org.ovirt.engine.ui.common.utils.WebUtils.openUrlInNewWindow ( "_blank" , ( docBase + docPath ) , WebUtils.OPTION_SCROLLBARS ) ; }
Source:
protected org.ovirt.engine.core.common.queries.VdcQueryReturnValue getExistingStorageDomainList ( org.ovirt.engine.core.common.businessentities.StorageServerConnections storageServerConnection ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue = org.ovirt.engine.core.bll.storage.domain.GetFileStorageDomainsWithAttachedStoragePoolGuidQuery.getBackend ( ) . runInternalQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( org.ovirt.engine.core.bll.storage.domain.GetFileStorageDomainsWithAttachedStoragePoolGuidQuery.getVdsId ( ) , storageServerConnection.getstorage_type ( ) , org.ovirt.engine.core.common.businessentities.StorageDomainType.Data , storageServerConnection.getconnection ( ) ) ) ; return returnValue ; }

Target:
protected org.ovirt.engine.core.common.queries.VdcQueryReturnValue getExistingStorageDomainList ( org.ovirt.engine.core.common.businessentities.StorageServerConnections storageServerConnection ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue = org.ovirt.engine.core.bll.storage.domain.GetFileStorageDomainsWithAttachedStoragePoolGuidQuery.getBackend ( ) . runInternalQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( org.ovirt.engine.core.bll.storage.domain.GetFileStorageDomainsWithAttachedStoragePoolGuidQuery.getVdsId ( ) , storageServerConnection.getStorageType ( ) , org.ovirt.engine.core.common.businessentities.StorageDomainType.Data , storageServerConnection.getConnection ( ) ) ) ; return returnValue ; }
Source:
protected void setUpFactory ( org.ovirt.engine.core.bll.MultipleActionsRunnerBaseTest.TestCommand ... commands ) { org.mockito.stubbing.OngoingStubbing stubbing = org.mockito.Mockito.when ( commandFactory.createWrappedCommand ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.bll.context.CommandContext.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.action.VdcActionType.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.action.VdcActionParametersBase.class ) , org.mockito.ArgumentMatchers.anyBoolean ( ) ) ) ; for ( org.ovirt.engine.core.bll.MultipleActionsRunnerBaseTest.TestCommand command : commands ) { stubbing = stubbing.thenReturn ( command ) ; } }

Target:
protected void setUpFactory ( org.ovirt.engine.core.bll.MultipleActionsRunnerBaseTest.TestCommand ... commands ) { org.mockito.stubbing.OngoingStubbing stubbing = org.mockito.Mockito.when ( commandFactory.createWrappedCommand ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.bll.context.CommandContext.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.action.ActionType.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.action.VdcActionParametersBase.class ) , org.mockito.ArgumentMatchers.anyBoolean ( ) ) ) ; for ( org.ovirt.engine.core.bll.MultipleActionsRunnerBaseTest.TestCommand command : commands ) { stubbing = stubbing.thenReturn ( command ) ; } }
Source:
public static void getRoleActionGroupsByRoleId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid roleId ) { 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.ActionGroup > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetRoleActionGroupsByRoleId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( roleId ) , aQuery ) ; }

Target:
public void getPermissionsByAdElementId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid userId ) { 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.Permissions > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Permissions > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetPermissionsByAdElementId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( userId ) , aQuery ) ; }
Source:
protected void endSuccessfully ( ) { org.ovirt.engine.core.compat.Guid createdDiskId = ( ( org.ovirt.engine.core.compat.Guid ) ( org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.getActionReturnValue ( ) ) ) ; endChildCommand ( true ) ; org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo storageDomainOvfInfoDb = org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.getStorageDomainOvfInfoDao ( ) . get ( createdDiskId ) ; if ( ( storageDomainOvfInfoDb == null ) || ( ( storageDomainOvfInfoDb.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfoStatus.DISABLED ) ) ) { return ; } storageDomainOvfInfoDb.setStatus ( StorageDomainOvfInfoStatus.OUTDATED ) ; org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.getStorageDomainOvfInfoDao ( ) . update ( storageDomainOvfInfoDb ) ; org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.setSucceeded ( true ) ; }

Target:
protected void endSuccessfully ( ) { org.ovirt.engine.core.compat.Guid createdDiskId = ( ( org.ovirt.engine.core.compat.Guid ) ( org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.getActionReturnValue ( ) ) ) ; endChildCommand ( true ) ; org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfo storageDomainOvfInfoDb = storageDomainOvfInfoDao.get ( createdDiskId ) ; if ( ( storageDomainOvfInfoDb == null ) || ( ( storageDomainOvfInfoDb.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.StorageDomainOvfInfoStatus.DISABLED ) ) ) { return ; } storageDomainOvfInfoDb.setStatus ( StorageDomainOvfInfoStatus.OUTDATED ) ; storageDomainOvfInfoDao.update ( storageDomainOvfInfoDb ) ; org.ovirt.engine.core.bll.storage.ovfstore.CreateOvfVolumeForStorageDomainCommand.setSucceeded ( true ) ; }
Source:
private static boolean canPlugInterfaceInDc ( java.lang.String macAddress , org.ovirt.engine.core.compat.Guid dataCenterId ) { if ( dataCenterId == null ) { return false ; } if ( macAddress == null ) { return true ; } org.ovirt.engine.core.bll.network.macpoolmanager.MacPoolManagerStrategy pool = org.ovirt.engine.core.bll.network.macpoolmanager.MacPoolPerDcSingleton.getInstance ( ) . poolForDataCenter ( dataCenterId ) ; return ! ( pool.isMacInUse ( macAddress ) ) ; }

Target:
private static boolean canPlugInterface ( org.ovirt.engine.core.common.businessentities.network.VmNic iface ) { org.ovirt.engine.core.bll.network.VmInterfaceManager vmIfaceManager = new org.ovirt.engine.core.bll.network.VmInterfaceManager ( ) ; if ( vmIfaceManager.existsPluggedInterfaceWithSameMac ( iface ) ) { vmIfaceManager.auditLogMacInUseUnplug ( iface ) ; return false ; } else { return true ; } }
Source:
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 ) ; }

Target:
public void getClusterFeaturesByClusterId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { 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.Set < org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature > ) ( source ) ) : new java.util.HashSet < org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClusterFeaturesByClusterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }
Source:
protected void SyncSearch ( ) { org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; asyncQuery.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) @ java.lang.Override public void OnSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { setItems ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ) ; } } ; org.ovirt.engine.core.common.queries.VdcQueryParametersBase params = new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) ; params.setRefresh ( getIsQueryFirstTime ( ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllProviders , params , asyncQuery ) ; }

Target:
protected void syncSearch ( ) { org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; asyncQuery.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { setItems ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ) ; } } ; org.ovirt.engine.core.common.queries.VdcQueryParametersBase params = new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) ; params.setRefresh ( getIsQueryFirstTime ( ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllProviders , params , asyncQuery ) ; }
Source:
public void executeCommandWhenFailed ( ) { setUpMocksForUpdate ( ) ; mockBackend ( false , EngineError.GlusterHookUpdateFailed ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.never ( ) ) . updateGlusterHook ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_UPDATE_FAILED , cmd.getAuditLogTypeValue ( ) ) ; }

Target:
public void executeCommandWhenFailed ( ) { setUpMocksForUpdate ( ) ; mockBackend ( false , EngineError.GlusterHookUpdateFailed ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.never ( ) ) . updateGlusterHook ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( AuditLogType.GLUSTER_HOOK_UPDATE_FAILED , cmd.getAuditLogTypeValue ( ) ) ; }
Source:
public void canDoActionVmIsNotDown ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( StorageType.NFS ) ; org.mockito.Mockito.doReturn ( vmDeviceDao ) . when ( command ) . getVmDeviceDAO ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN.toString ( ) ) ) ; }

Target:
public void canDoActionDiskIsOvfStore ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( false ) ; command.getImage ( ) . setOvfStore ( true ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_OVF_DISK_NOT_SUPPORTED ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVmTemplateDao ( ) ; existingTemplate = dao.get ( new org.ovirt.engine.core.compat.Guid ( "1b85420c-b84c-4f29-997e-0eb674b40b79" ) ) ; newVmTemplate = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; newVmTemplate.setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; newVmTemplate.setname ( "NewVmTemplate" ) ; newVmTemplate.setvds_group_id ( org.ovirt.engine.core.dao.VmTemplateDAOTest.VDS_GROUP_ID ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVmTemplateDao ( ) ; existingTemplate = dao.get ( new org.ovirt.engine.core.compat.Guid ( "1b85420c-b84c-4f29-997e-0eb674b40b79" ) ) ; newVmTemplate = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; newVmTemplate.setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; newVmTemplate.setname ( "NewVmTemplate" ) ; newVmTemplate.setVdsGroupId ( org.ovirt.engine.core.dao.VmTemplateDAOTest.VDS_GROUP_ID ) ; }
Source:
protected void initFrontend ( ) { frontend.setEventsHandler ( frontendEventsHandler ) ; frontend.getFrontendFailureEvent ( ) . addListener ( frontendFailureEventListener ) ; frontend.getFrontendNotLoggedInEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { user.logout ( ) ; } } ) ; frontend.setFilterQueries ( filterFrontendQueries ( ) ) ; }

Target:
public void onLogout ( ) { restApiSessionManager.releaseSession ( ) ; }
Source:
public com.google.gwt.safehtml.shared.SafeHtml getValue ( T object ) { java.lang.Integer progressValue = getProgressValue ( object ) ; int progress = ( progressValue != null ) ? progressValue : 0 ; java.lang.String text = getProgressText ( object ) ; java.lang.String color = getColorByProgress ( progress ) ; return templates.progressBar ( progress , text , color , getStyle ( ) ) ; }

Target:
public com.google.gwt.safehtml.shared.SafeHtml getValue ( T object ) { java.lang.Integer progressValue = getProgressValue ( object ) ; int progress = ( progressValue != null ) ? progressValue : 0 ; java.lang.String text = getProgressText ( object ) ; java.lang.String color = getColorByProgress ( progress ) ; return org.ovirt.engine.ui.webadmin.widget.table.column.AbstractProgressBarColumn.templates.progressBar ( progress , text , color , getStyle ( ) , com.google.gwt.user.client.DOM.createUniqueId ( ) ) ; }
Source:
private org.ovirt.engine.core.bll.ValidationResult networkNotUsedByRunningVm ( ) { java.lang.String networkName = org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getNetworkName ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getVdsGroupDAO ( ) . getAllForStoragePool ( org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getStoragePool ( ) . getId ( ) ) ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > vms = org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getVmStaticDAO ( ) . getAllByGroupAndNetworkName ( cluster.getId ( ) , networkName ) ; if ( ( vms.size ( ) ) > 0 ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.dal.VdcBllMessages.NETWORK_INTERFACE_IN_USE_BY_VM ) ; } } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
private org.ovirt.engine.core.bll.ValidationResult networkNotUsedByRunningVm ( ) { java.lang.String networkName = org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getNetworkName ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : getClusters ( ) ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > vms = org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getVmStaticDAO ( ) . getAllByGroupAndNetworkName ( cluster.getId ( ) , networkName ) ; if ( ( vms.size ( ) ) > 0 ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.dal.VdcBllMessages.NETWORK_INTERFACE_IN_USE_BY_VM ) ; } } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private void incrementVdsPendingVmsCount ( ) { synchronized ( _vds_pending_vm_count ) { if ( ! ( _vds_pending_vm_count.containsKey ( org.ovirt.engine.core.bll.RunVmCommand.getVdsId ( ) ) ) ) { _vds_pending_vm_count.put ( org.ovirt.engine.core.bll.RunVmCommand.getVdsId ( ) , 1 ) ; } else { int i = _vds_pending_vm_count.get ( org.ovirt.engine.core.bll.RunVmCommand.getVdsId ( ) ) ; _vds_pending_vm_count.put ( org.ovirt.engine.core.bll.RunVmCommand.getVdsId ( ) , ( i + 1 ) ) ; } } }

Target:
protected void perform ( ) { switch ( getFlow ( ) ) { case RESUME_PAUSE : resumeVm ( ) ; break ; case REMOVE_STATELESS_IMAGES : removeVmStatlessImages ( ) ; break ; case CREATE_STATELESS_IMAGES : statelessVmTreatment ( ) ; break ; case RESUME_HIBERNATE : case RUN : default : runVm ( ) ; } }
Source:
public void canDoActionTemplateImageIsLocked ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Copy , new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initTemplateDiskImage ( ) ; command.getImage ( ) . setImageStatus ( ImageStatus.LOCKED ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ) . when ( command ) . getTemplateForImage ( ) ; command.defineVmTemplate ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.VM_TEMPLATE_IMAGE_IS_LOCKED.toString ( ) ) ) ; }

Target:
public void validateTemplateImageIsLocked ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Copy , new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initTemplateDiskImage ( ) ; command.getImage ( ) . setImageStatus ( ImageStatus.LOCKED ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ) . when ( command ) . getTemplateForImage ( ) ; command.defineVmTemplate ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.VM_TEMPLATE_IMAGE_IS_LOCKED.toString ( ) ) ) ; }
Source:
public static void getExistingStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.common.businessentities.StorageDomainType domainType , org.ovirt.engine.core.common.businessentities.StorageType storageType , java.lang.String path ) { 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.StorageDomain > ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( hostId , storageType , domainType , path ) , aQuery ) ; }

Target:
public static void getStorageDomainList ( 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 ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ( ) ; } } ; org.ovirt.engine.core.common.queries.SearchParameters searchParams = new org.ovirt.engine.core.common.queries.SearchParameters ( "Storage:" , org.ovirt.engine.core.common.interfaces.SearchType.StorageDomain ) ; searchParams.setMaxCount ( 9999 ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.Search , searchParams , aQuery ) ; }
Source:
protected void verifyModel ( org.ovirt.engine.api.model.ReportedDevice model , int index ) { assertEquals ( NAMES [ index ] , model.getName ( ) ) ; assertEquals ( org.ovirt.engine.api.restapi.resource.BackendVmReportedDevicesResourceTest.PARENT_ID.toString ( ) , model.getVm ( ) . getId ( ) ) ; verifyIps ( model ) ; verifyLinks ( model ) ; }

Target:
protected void verifyModel ( org.ovirt.engine.api.model.ReportedDevice model , int index ) { org.junit.Assert.assertEquals ( NAMES [ index ] , model.getName ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.api.restapi.resource.BackendVmReportedDevicesResourceTest.PARENT_ID.toString ( ) , model.getVm ( ) . getId ( ) ) ; verifyIps ( model ) ; verifyLinks ( model ) ; }