auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void versionDecreaseNoHostsOrNetwork ( ) { createCommandWithOlderVersion ( true , false ) ; setupCpu ( ) ; org.ovirt.engine.core.dao.StoragePoolDao storagePoolDao2 = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDao.class ) ; org.mockito.Mockito.when ( storagePoolDao2.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.createStoragePoolLocalFS ( ) ) ; org.mockito.Mockito.doReturn ( storagePoolDao2 ) . when ( cmd ) . getStoragePoolDao ( ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void versionDecreaseNoHostsOrNetwork ( ) { createCommandWithOlderVersion ( true , false ) ; setupCpu ( ) ; org.ovirt.engine.core.dao.StoragePoolDao storagePoolDao2 = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDao.class ) ; org.mockito.Mockito.when ( storagePoolDao2.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateClusterCommandTest.createStoragePoolLocalFS ( ) ) ; org.mockito.Mockito.doReturn ( storagePoolDao2 ) . when ( cmd ) . getStoragePoolDao ( ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
protected void mapVolumeGroupFcp ( org.ovirt.engine.api.model.StorageDomain model , org.ovirt.engine.api.model.StorageDomain entity ) { org.ovirt.engine.api.model.VolumeGroup vg = model.getStorage ( ) . getVolumeGroup ( ) ; for ( org.ovirt.engine.core.common.businessentities.LUNs lun : getLunsByVgId ( vg.getId ( ) ) ) { org.ovirt.engine.api.model.LogicalUnit unit = map ( lun ) ; vg.getLogicalUnits ( ) . add ( unit ) ; } }

Target:
protected void mapVolumeGroupFcp ( org.ovirt.engine.api.model.StorageDomain model , org.ovirt.engine.api.model.StorageDomain entity ) { org.ovirt.engine.api.model.VolumeGroup vg = model.getStorage ( ) . getVolumeGroup ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.LUNs lun : getLunsByVgId ( vg.getId ( ) ) ) { org.ovirt.engine.api.model.LogicalUnit unit = map ( lun ) ; vg.getLogicalUnits ( ) . add ( unit ) ; } }
Source:
protected < T > T getEntity ( java.lang.Class < T > clz , org.ovirt.engine.core.common.interfaces.SearchType searchType , java.lang.String constraint ) { try { org.ovirt.engine.core.common.queries.VdcQueryReturnValue result = runQuery ( VdcQueryType.Search , createSearchParameters ( searchType , constraint ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { backendFailure ( result.getExceptionString ( ) ) ; } return castQueryResultToEntity ( clz , result , constraint ) ; } catch ( java.lang.Exception e ) { return handleError ( clz , e , false ) ; } }

Target:
protected < T > T getEntity ( java.lang.Class < T > clz , org.ovirt.engine.core.common.interfaces.SearchType searchType , java.lang.String constraint ) { try { org.ovirt.engine.core.common.queries.QueryReturnValue result = runQuery ( QueryType.Search , createSearchParameters ( searchType , constraint ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { backendFailure ( result.getExceptionString ( ) ) ; } return castQueryResultToEntity ( clz , result , constraint ) ; } catch ( java.lang.Exception e ) { return handleError ( clz , e , false ) ; } }
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 getGlusterVolumeGeoRepRecommendationViolations ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid masterVolumeId , org.ovirt.engine.core.compat.Guid slaveVolumeId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object returnValue , org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery ) { return returnValue == null ? new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason > ( ) : ( ( java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason > ) ( returnValue ) ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetNonEligibilityReasonsOfVolumeForGeoRepSession , new org.ovirt.engine.core.common.queries.gluster.GlusterVolumeGeoRepEligibilityParameters ( masterVolumeId , slaveVolumeId ) , aQuery ) ; }
Source:
static org.ovirt.engine.api.model.Vm getModel ( int index ) { org.ovirt.engine.api.model.Vm model = new org.ovirt.engine.api.model.Vm ( ) ; model.setName ( NAMES [ index ] ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setCluster ( new org.ovirt.engine.api.model.Cluster ( ) ) ; model.getCluster ( ) . setId ( GUIDS [ 2 ] . toString ( ) ) ; return model ; }

Target:
static org.ovirt.engine.api.model.Vm getModel ( int index ) { org.ovirt.engine.api.model.Vm model = new org.ovirt.engine.api.model.Vm ( ) ; model.setName ( NAMES [ index ] ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setCluster ( new org.ovirt.engine.core.common.businessentities.Cluster ( ) ) ; model.getCluster ( ) . setId ( GUIDS [ 2 ] . toString ( ) ) ; return model ; }
Source:
private void initFilter ( ) { filter = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.memory.sdfilters.StorageDomainSpaceRequirementsFilter ( memoryDisks ) ) ; org.mockito.Mockito.doNothing ( ) . when ( filter ) . updateDisksStorage ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.StorageDomain.class ) , org.mockito.Matchers.anyListOf ( org.ovirt.engine.core.common.businessentities.storage.DiskImage.class ) ) ; org.mockito.Mockito.doReturn ( storageDomainValidator ) . when ( filter ) . getStorageDomainValidator ( storageDomain ) ; }

Target:
private void initFilter ( ) { filter = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.memory.sdfilters.StorageDomainSpaceRequirementsFilter ( memoryDisks ) ) ; org.mockito.Mockito.doNothing ( ) . when ( filter ) . updateDisksStorage ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.businessentities.StorageDomain.class ) , org.mockito.ArgumentMatchers.anyListOf ( org.ovirt.engine.core.common.businessentities.storage.DiskImage.class ) ) ; org.mockito.Mockito.doReturn ( storageDomainValidator ) . when ( filter ) . getStorageDomainValidator ( storageDomain ) ; }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { switch ( command.getName ( ) ) { case "OnRemove" : onRemove ( ) ; break ; case "OnRestore" : onRestore ( ) ; break ; case "RemoveVmTemplates" : removeTemplateBackup ( ) ; break ; default : super . executeCommand ( command ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { switch ( command.getName ( ) ) { case "OnRemove" : onRemove ( ) ; break ; case "OnRestore" : onRestore ( ) ; break ; case "RemoveVmTemplates" : removeTemplateBackup ( ) ; break ; case "onClone" : onClone ( ) ; break ; case "closeClone" : closeClone ( ) ; break ; case "multipleArchsOK" : multipleArchsOK ( ) ; break ; default : super . executeCommand ( command ) ; } }
Source:
protected void updateActionAvailability ( ) { super . updateActionAvailability ( ) ; getConnectCommand ( ) . setIsExecutionAllowed ( ( ( ( ( getEntity ( ) ) != null ) && ( ( ( getEntity ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VMStatus.Up ) ) || ( ( getEntity ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VMStatus.PoweringDown ) ) ) ) && ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.isWindowsOsType ( getEntity ( ) . getVmOsId ( ) ) ) ) ) ; }

Target:
public boolean canBeSelected ( ) { return org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.isWindowsOsType ( getEntity ( ) . getOs ( ) ) ; }
Source:
public static void GetNetworkList ( 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 != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }

Target:
public static void getNetworkList ( 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 != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
public void isVirtioScsiEnabledDefaultedToTrue ( ) { mockOsRepository ( ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( createVdsGroup ( ) ) . when ( cmd ) . getVdsGroup ( ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( java.util.Arrays.asList ( "VirtIO_SCSI" ) ) ) ; junit.framework.Assert.assertTrue ( "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3." , cmd.isVirtioScsiEnabled ( ) ) ; }

Target:
public void isVirtioScsiEnabledDefaultedToTrue ( ) { mockOsRepository ( ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( createVdsGroup ( ) ) . when ( cmd ) . getVdsGroup ( ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( java.util.Arrays.asList ( "VirtIO_SCSI" ) ) ) ; org.junit.Assert.assertTrue ( "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3." , cmd.isVirtioScsiEnabled ( ) ) ; }
Source:
protected boolean migrateVm ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.bll.job.ExecutionContext parentContext ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vm.getId ( ) ) ; parameters.setReason ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.MessageBundler.getMessage ( AuditLogType.MIGRATION_REASON_HOST_IN_MAINTENANCE ) ) ; return runInternalAction ( VdcActionType.MigrateVm , parameters , createMigrateVmContext ( parentContext , vm ) ) . getSucceeded ( ) ; }

Target:
protected boolean migrateVm ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.bll.job.ExecutionContext parentContext ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vm.getId ( ) ) ; parameters.setReason ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.MessageBundler.getMessage ( AuditLogType.MIGRATION_REASON_HOST_IN_MAINTENANCE ) ) ; return runInternalAction ( ActionType.MigrateVm , parameters , createMigrateVmContext ( parentContext , vm ) ) . getSucceeded ( ) ; }
Source:
protected void addCustomValuesStorage ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase auditLogableBase , java.lang.String quotaName , double storageUsagePercentage , double storageRequestedPercentage ) { auditLogableBase.AddCustomValue ( "QuotaName" , quotaName ) ; auditLogableBase.AddCustomValue ( "CurrentStorage" , org.ovirt.engine.core.bll.quota.QuotaManagerAuditLogger.percentageFormatter.format ( storageUsagePercentage ) ) ; auditLogableBase.AddCustomValue ( "Requested" , org.ovirt.engine.core.bll.quota.QuotaManagerAuditLogger.percentageFormatter.format ( storageRequestedPercentage ) ) ; }

Target:
protected void addCustomValuesStorage ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase auditLogableBase , java.lang.String quotaName , double storageUsagePercentage , double storageRequestedPercentage ) { auditLogableBase.addCustomValue ( "QuotaName" , quotaName ) ; auditLogableBase.addCustomValue ( "CurrentStorage" , org.ovirt.engine.core.bll.quota.QuotaManagerAuditLogger.percentageFormatter.format ( storageUsagePercentage ) ) ; auditLogableBase.addCustomValue ( "Requested" , org.ovirt.engine.core.bll.quota.QuotaManagerAuditLogger.percentageFormatter.format ( storageRequestedPercentage ) ) ; }
Source:
protected org.ovirt.engine.api.model.Network getEntity ( int index ) { org.ovirt.engine.api.model.Network entity = org.mockito.Mockito.mock ( org.ovirt.engine.api.model.Network.class ) ; org.mockito.Mockito.when ( entity.getId ( ) ) . thenReturn ( GUIDS [ index ] ) ; org.mockito.Mockito.when ( entity.getName ( ) ) . thenReturn ( NAMES [ index ] ) ; org.mockito.Mockito.when ( entity.getDescription ( ) ) . thenReturn ( DESCRIPTIONS [ index ] ) ; org.mockito.Mockito.when ( entity.getDataCenterId ( ) ) . thenReturn ( GUIDS [ 1 ] ) ; return entity ; }

Target:
protected void setUpEntityQueryExpectations ( int times ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpEntityQueryExpectations ( VdcQueryType.GetNetworksByDataCenterId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendDataCenterNetworkResourceTest.dataCenterId } , getEntityList ( ) ) ; } }
Source:
public void getClusterDesktopMemoryOverCommit ( 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.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxVdsMemOverCommit , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public void getClusterDesktopMemoryOverCommit ( 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.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxVdsMemOverCommit , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
public static void getLunsByVgId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String vgId , org.ovirt.engine.core.compat.Guid vdsId ) { 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.LUNs > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.LUNs > ( ) ; } } ; org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters params = new org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters ( vgId , vdsId ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetLunsByVgId , params , aQuery ) ; }

Target:
public void getoVirtISOsList ( 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 ? new java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ( ( ( java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ) ( source ) ) ) : new java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetoVirtISOs , new org.ovirt.engine.core.common.queries.VdsIdParametersBase ( id ) , aQuery ) ; }
Source:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } if ( ( ( org.ovirt.engine.core.bll.network.template.VmTemplateInterfaceCommandBase.getVdsGroup ( ) ) == null ) && ( ( org.ovirt.engine.core.bll.network.template.VmTemplateInterfaceCommandBase.getVmTemplate ( ) . getTemplateType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.INSTANCE_TYPE ) ) ) { addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY ) ; return false ; } return true ; }

Target:
protected boolean validate ( ) { if ( ! ( super . validate ( ) ) ) { return false ; } if ( ( ( org.ovirt.engine.core.bll.network.template.VmTemplateInterfaceCommandBase.getVdsGroup ( ) ) == null ) && ( ( org.ovirt.engine.core.bll.network.template.VmTemplateInterfaceCommandBase.getVmTemplate ( ) . getTemplateType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.INSTANCE_TYPE ) ) ) { addValidationMessage ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY ) ; return false ; } return true ; }
Source:
protected void writeAdditionalContent ( com.google.gwt.core.ext.TreeLogger logger , com.google.gwt.core.ext.GeneratorContext context , com.google.gwt.editor.rebind.model.EditorModel model , com.google.gwt.user.rebind.SourceWriter sw ) throws com.google.gwt.core.ext.UnableToCompleteException { com.google.gwt.core.ext.typeinfo.TypeOracle typeOracle = context.getTypeOracle ( ) ; entityModelType = typeOracle.findType ( "org.ovirt.engine.ui.uicommonweb.models.EntityModel" ) ; listModelType = typeOracle.findType ( "org.ovirt.engine.ui.uicommonweb.models.ListModel" ) ; this . logger = logger ; this . model = model ; this . sw = sw ; logger.log ( Type.DEBUG , "Strating to write additional Driver code" ) ; writeListenerMap ( ) ; writeEventMap ( ) ; writeOwnerModels ( ) ; }

Target:
protected void writeAdditionalContent ( com.google.gwt.core.ext.TreeLogger logger , com.google.gwt.core.ext.GeneratorContext context , com.google.gwt.editor.rebind.model.EditorModel model , com.google.gwt.user.rebind.SourceWriter sw ) throws com.google.gwt.core.ext.UnableToCompleteException { com.google.gwt.core.ext.typeinfo.TypeOracle typeOracle = context.getTypeOracle ( ) ; entityModelType = eraseType ( typeOracle.findType ( "org.ovirt.engine.ui.uicommonweb.models.EntityModel" ) ) ; listModelType = eraseType ( typeOracle.findType ( "org.ovirt.engine.ui.uicommonweb.models.ListModel" ) ) ; this . logger = logger ; this . model = model ; this . sw = sw ; logger.log ( Type.DEBUG , "Strating to write additional Driver code" ) ; writeListenerMap ( ) ; writeEventMap ( ) ; writeOwnerModels ( ) ; }
Source:
protected boolean validate ( ) { org.ovirt.engine.core.compat.Guid id = org.ovirt.engine.core.bll.aaa.RemoveUserCommand.getParameters ( ) . getId ( ) ; if ( org.ovirt.engine.core.bll.aaa.RemoveUserCommand.getCurrentUser ( ) . getId ( ) . equals ( id ) ) { addValidationMessage ( EngineMessage.USER_CANNOT_REMOVE_HIMSELF ) ; return false ; } org.ovirt.engine.core.common.businessentities.aaa.DbUser dbUser = org.ovirt.engine.core.bll.aaa.RemoveUserCommand.getDbUserDao ( ) . get ( id ) ; if ( dbUser == null ) { addValidationMessage ( EngineMessage.USER_MUST_EXIST_IN_DB ) ; return false ; } return true ; }

Target:
protected boolean validate ( ) { org.ovirt.engine.core.compat.Guid id = org.ovirt.engine.core.bll.aaa.RemoveUserCommand.getParameters ( ) . getId ( ) ; if ( org.ovirt.engine.core.bll.aaa.RemoveUserCommand.getCurrentUser ( ) . getId ( ) . equals ( id ) ) { addValidationMessage ( EngineMessage.USER_CANNOT_REMOVE_HIMSELF ) ; return false ; } org.ovirt.engine.core.common.businessentities.aaa.DbUser dbUser = dbUserDao.get ( id ) ; if ( dbUser == null ) { addValidationMessage ( EngineMessage.USER_MUST_EXIST_IN_DB ) ; return false ; } return true ; }
Source:
public void initTable ( org.ovirt.engine.ui.common.CommonApplicationConstants constants ) { this . constants = constants ; initTableOverhead ( ) ; handleRadioButtonClick ( null ) ; org.ovirt.engine.ui.common.widget.uicommon.vm.BaseVmDiskListModelTable.getModel ( ) . getItemsChangedEvent ( ) . 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 ) { disksViewRadioGroup.setDiskStorageType ( ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType ) ( getModel ( ) . getDiskViewType ( ) . getEntity ( ) ) ) ) ; } } ) ; }

Target:
public void initTable ( org.ovirt.engine.ui.common.CommonApplicationConstants constants ) { this . constants = constants ; initTableColumns ( ) ; initTableOverhead ( ) ; handleRadioButtonClick ( null ) ; org.ovirt.engine.ui.common.widget.uicommon.vm.BaseVmDiskListModelTable.getModel ( ) . getItemsChangedEvent ( ) . 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 ) { disksViewRadioGroup.setDiskStorageType ( ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType ) ( getModel ( ) . getDiskViewType ( ) . getEntity ( ) ) ) ) ; } } ) ; }
Source:
public static boolean CheckIfServerAndClusterCanFit ( java.lang.String clusterCpuName , java.lang.String serverFlags , 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.CheckIfServerAndClusterCanFit ( clusterCpuName , serverFlags ) ; } return false ; }

Target:
public static boolean isCpuUpdatable ( 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 ) ; org.ovirt.engine.core.common.businessentities.ServerCpu server = null ; if ( cpuFlagsManager != null ) { server = cpuFlagsManager.getServerCpuByName ( cpuName ) ; } int serverLevel = ( server != null ) ? server.getLevel ( ) : 0 ; return serverLevel != 0 ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { if ( "ForceLabel" . equals ( ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) . PropertyName ) ) { org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel entity = ( ( org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel ) ( sender ) ) ; force.setLabel ( entity.getForceLabel ( ) ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { if ( "ForceLabel" . equals ( ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) . propertyName ) ) { org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel entity = ( ( org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel ) ( sender ) ) ; force.setLabel ( entity.getForceLabel ( ) ) ; } }
Source:
private void periodicPauseLog ( org.ovirt.engine.core.common.businessentities.storage.ImageTransfer entity , long ts ) { if ( ts >= ( ( org.ovirt.engine.core.bll.storage.disk.image.UploadImageCommand.getParameters ( ) . getLastPauseLogTime ( ) ) + ( getPauseLogInterval ( ) ) ) ) { log.info ( "Upload to was paused by {}" , getUploadDescription ( ) , ( ( entity.getPhase ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.ImageTransferPhase.PAUSED_SYSTEM ) ? "system" : "user" ) ) ; resetPeriodicPauseLogTime ( ts ) ; } }

Target:
private void periodicPauseLog ( org.ovirt.engine.core.common.businessentities.storage.ImageTransfer entity , long ts ) { if ( ts >= ( ( org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getParameters ( ) . getLastPauseLogTime ( ) ) + ( getPauseLogInterval ( ) ) ) ) { log.info ( "Transfer was paused by {}. {}" , ( ( entity.getPhase ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.ImageTransferPhase.PAUSED_SYSTEM ) ? "system" : "user" ) , getTransferDescription ( ) ) ; resetPeriodicPauseLogTime ( ts ) ; } }
Source:
private void networkNotUsedByVmsTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.VM > vms ) { org.ovirt.engine.core.dao.VmDAO vmDao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmDAO.class ) ; org.mockito.Mockito.when ( vmDao.getAllForNetwork ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vms ) ; org.mockito.Mockito.when ( dbFacade.getVmDao ( ) ) . thenReturn ( vmDao ) ; org.junit.Assert.assertThat ( validator.networkNotUsedByVms ( ) , matcher ) ; }

Target:
private void networkNotUsedByVmsTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.VM > vms ) { org.ovirt.engine.core.dao.VmDao vmDao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmDao.class ) ; org.mockito.Mockito.when ( vmDao.getAllForNetwork ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vms ) ; org.mockito.Mockito.when ( dbFacade.getVmDao ( ) ) . thenReturn ( vmDao ) ; org.junit.Assert.assertThat ( validator.networkNotUsedByVms ( ) , matcher ) ; }
Source:
private boolean registerLibvirtSecrets ( org.ovirt.engine.core.common.businessentities.VDS vds , java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets , boolean clearUnusedSecrets ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.RegisterLibvirtSecrets , new org.ovirt.engine.core.common.vdscommands.RegisterLibvirtSecretsVDSParameters ( vds.getId ( ) , libvirtSecrets , clearUnusedSecrets ) ) ; if ( ! ( returnValue.getSucceeded ( ) ) ) { org.ovirt.engine.core.bll.storage.CINDERStorageHelper.log.error ( "Failed to register libvirt secret on vds {}." , vds.getName ( ) ) ; return false ; } return true ; }

Target:
private boolean handleLibvirtSecrets ( org.ovirt.engine.core.bll.context.CommandContext cmdContext , org.ovirt.engine.core.common.businessentities.VDS vds , org.ovirt.engine.core.compat.Guid poolId ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getLibvirtSecretDao ( ) . getAllByStoragePoolIdFilteredByActiveStorageDomains ( poolId ) ; if ( ( ! ( libvirtSecrets.isEmpty ( ) ) ) && ( ! ( registerLibvirtSecretsImpl ( vds , libvirtSecrets , false ) ) ) ) { org.ovirt.engine.core.bll.storage.CINDERStorageHelper.log.error ( "Failed to register libvirt secret on vds {}." , vds.getName ( ) ) ; setNonOperational ( cmdContext , vds.getId ( ) , NonOperationalReason.LIBVIRT_SECRETS_REGISTRATION_FAILURE ) ; return false ; } return true ; }
Source:
public static void setUpOsRepository ( ) { org.ovirt.engine.core.common.osinfo.OsRepository osRepository = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) ; org.ovirt.engine.core.common.utils.SimpleDependencyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; org.mockito.Mockito.when ( osRepository.getVmWatchdogTypes ( org.mockito.ArgumentMatchers.anyInt ( ) , org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateWatchdogCommandTest.WATCHDOG_MODELS ) ; }

Target:
public void setUpOsRepository ( ) { org.ovirt.engine.core.common.osinfo.OsRepository osRepository = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) ; injectorRule.bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; org.mockito.Mockito.when ( osRepository.getVmWatchdogTypes ( org.mockito.ArgumentMatchers.anyInt ( ) , org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateWatchdogCommandTest.WATCHDOG_MODELS ) ; }
Source:
private org.ovirt.engine.core.bll.ValidationResult validateCoherentNicIdentification ( org.ovirt.engine.core.common.businessentities.network.Bond bond ) { org.ovirt.engine.core.compat.Guid nicId = bond.getId ( ) ; java.lang.String nicName = bond.getName ( ) ; org.ovirt.engine.core.common.errors.EngineMessage message = org.ovirt.engine.core.common.errors.EngineMessage.BOND_REFERENCES_NICS_INCOHERENTLY ; return org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidator.validateCoherentIdentification ( bond.getName ( ) , nicId , nicName , message , existingInterfacesMap ) ; }

Target:
private org.ovirt.engine.core.bll.ValidationResult validateCoherentNicIdentification ( org.ovirt.engine.core.common.businessentities.network.Bond bond ) { org.ovirt.engine.core.compat.Guid nicId = bond.getId ( ) ; java.lang.String nicName = bond.getName ( ) ; org.ovirt.engine.core.common.errors.EngineMessage message = org.ovirt.engine.core.common.errors.EngineMessage.BOND_REFERENCES_NICS_INCOHERENTLY ; return hostSetupNetworksValidatorHelper.validateCoherentIdentification ( bond.getName ( ) , nicId , nicName , message , existingInterfacesMap ) ; }
Source:
private void updateVolumeFormat ( org.ovirt.engine.core.common.businessentities.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { setVolumeFormat ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getDiskVolumeFormat ( volumeType , storageType ) ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel diskModel = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel ) ( target ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType > cinderVolumeTypes = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType > ) ( returnValue ) ) ; java.util.List < java.lang.String > volumeTypesNames = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType cinderVolumeType : cinderVolumeTypes ) { volumeTypesNames.add ( cinderVolumeType.getName ( ) ) ; } volumeTypesNames.add ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.noCinderVolumeType ( ) ) ; diskModel.getCinderVolumeType ( ) . setItems ( volumeTypesNames ) ; }
Source:
public void setMainTabSelectedItem ( org.ovirt.engine.core.common.businessentities.StorageDomain selectedItem ) { org.ovirt.engine.ui.webadmin.section.main.view.tab.storage.SubTabStorageGeneralView.Driver.driver.edit ( getDetailModel ( ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomain entity = ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( getDetailModel ( ) . getEntity ( ) ) ) ; if ( entity == null ) return ; totalSize.setValue ( entity.getTotalDiskSize ( ) ) ; availableSize.setValue ( entity.getAvailableDiskSize ( ) ) ; usedSize.setValue ( entity.getUsedDiskSize ( ) ) ; overAllocationRatio.setValue ( entity.getStorageDomainOverCommitPercent ( ) ) ; formBuilder.showForm ( getDetailModel ( ) ) ; }

Target:
public void setMainTabSelectedItem ( org.ovirt.engine.core.common.businessentities.StorageDomain selectedItem ) { driver.edit ( getDetailModel ( ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomain entity = ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( getDetailModel ( ) . getEntity ( ) ) ) ; if ( entity != null ) { totalSize.setValue ( entity.getTotalDiskSize ( ) ) ; availableSize.setValue ( entity.getAvailableDiskSize ( ) ) ; usedSize.setValue ( entity.getUsedDiskSize ( ) ) ; overAllocationRatio.setValue ( entity.getStorageDomainOverCommitPercent ( ) ) ; } formBuilder.update ( getDetailModel ( ) ) ; }
Source:
public void testSaveAndGetById ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity snapshot = dao.getByName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDaoTest.NEW_SNAPSHOT_NAME ) ; org.junit.Assert.assertNull ( snapshot ) ; newSnapshot = insertTestSnapshot ( ) ; snapshot = dao.getById ( newSnapshot.getId ( ) ) ; org.junit.Assert.assertNotNull ( snapshot ) ; org.junit.Assert.assertEquals ( newSnapshot , snapshot ) ; }

Target:
public void testSaveAndGetById ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity snapshot = dao.getByName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDaoTest.NEW_SNAPSHOT_NAME ) ; org.junit.jupiter.api.Assertions.assertNull ( snapshot ) ; newSnapshot = insertTestSnapshot ( ) ; snapshot = dao.getById ( newSnapshot.getId ( ) ) ; org.junit.jupiter.api.Assertions.assertNotNull ( snapshot ) ; org.junit.jupiter.api.Assertions.assertEquals ( newSnapshot , snapshot ) ; }
Source:
private void storageDomain_SelectedItemChanged ( ) { updateQuota ( ( ( org.ovirt.engine.core.common.businessentities.StoragePool ) ( getDataCenter ( ) . getSelectedItem ( ) ) ) ) ; }

Target:
private void storageDomain_SelectedItemChanged ( ) { org.ovirt.engine.core.common.businessentities.StorageDomain selectedStorage = ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( getStorageDomain ( ) . getSelectedItem ( ) ) ) ; if ( selectedStorage != null ) { updateVolumeType ( selectedStorage.getStorageType ( ) ) ; } updateQuota ( ( ( org.ovirt.engine.core.common.businessentities.StoragePool ) ( getDataCenter ( ) . getSelectedItem ( ) ) ) ) ; }
Source:
public static void isTemplateNameUnique ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String name ) { 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 ( ) ) : false ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.IsVmTemlateWithSameNameExist , new org.ovirt.engine.core.common.queries.NameQueryParameters ( name ) , aQuery ) ; }

Target:
public static 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:
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 getNetworkList ( 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 != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
public static void IsBackendAvailable ( 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 ; } } ; org.ovirt.engine.core.common.queries.GetDomainListParameters tempVar = new org.ovirt.engine.core.common.queries.GetDomainListParameters ( ) ; tempVar.setFilterInternalDomain ( true ) ; org.ovirt.engine.ui.frontend.Frontend.RunPublicQuery ( VdcQueryType.GetDomainList , tempVar , aQuery ) ; }

Target:
public static java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmInterfaceType > GetNicTypeList ( org.ovirt.engine.core.common.businessentities.VmOsType osType , boolean hasDualmode ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmInterfaceType > list = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmInterfaceType > ( java.util.Arrays.asList ( org.ovirt.engine.core.common.businessentities.VmInterfaceType.values ( ) ) ) ; list.remove ( VmInterfaceType.rtl8139_pv ) ; if ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.IsWindowsOsType ( osType ) ) { list.remove ( VmInterfaceType.e1000 ) ; if ( ( osType == ( org.ovirt.engine.core.common.businessentities.VmOsType.WindowsXP ) ) && hasDualmode ) { list.add ( VmInterfaceType.rtl8139_pv ) ; } } return list ; }
Source:
public void updateChangeConnectionType ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections iscsiConnection = createISCSIConnection ( "10.35.16.25" , StorageType.ISCSI , "iqn.2013-04.myhat.com:aaa-target1" , "user1" , "mypassword123" ) ; parameters.setStorageServerConnection ( iscsiConnection ) ; org.mockito.Mockito.when ( storageConnDao.get ( iscsiConnection.getid ( ) ) ) . thenReturn ( oldNFSConnection ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_CHANGE_STORAGE_TYPE ) ; }

Target:
public void updateChangeConnectionType ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections iscsiConnection = createISCSIConnection ( "10.35.16.25" , StorageType.ISCSI , "iqn.2013-04.myhat.com:aaa-target1" , "3260" , "user1" , "mypassword123" ) ; parameters.setStorageServerConnection ( iscsiConnection ) ; org.mockito.Mockito.when ( storageConnDao.get ( iscsiConnection.getid ( ) ) ) . thenReturn ( oldNFSConnection ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_CHANGE_STORAGE_TYPE ) ; }
Source:
protected void setUpGetEntityExpectations ( int times , boolean notFound ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsGroupById , org.ovirt.engine.core.common.queries.GetVdsGroupByIdParameters.class , new java.lang.String [ ] { "VdsId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : getEntity ( 0 ) ) ) ; } }

Target:
protected void setUpGetEntityExpectations ( int times , boolean notFound ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsGroupById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : getEntity ( 0 ) ) ) ; } }
Source:
public org.ovirt.engine.core.compat.NGuid getStorageDomainId ( ) { if ( ( storageDomainId ) == null ) { java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > images = org.ovirt.engine.core.bll.AddVmFromSnapshotCommand.getDiskImageDao ( ) . getAllSnapshotsForVmSnapshot ( sourceSnapshotId ) ; storageDomainId = ( ! ( images.isEmpty ( ) ) ) ? images.get ( 0 ) . getstorage_ids ( ) . get ( 0 ) : org.ovirt.engine.core.compat.Guid.Empty ; } return storageDomainId ; }

Target:
public org.ovirt.engine.core.compat.NGuid getStorageDomainId ( ) { if ( ( storageDomainId ) == null ) { java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > images = org.ovirt.engine.core.bll.AddVmFromSnapshotCommand.getDiskImageDao ( ) . getAllSnapshotsForVmSnapshot ( sourceSnapshotId ) ; storageDomainId = ( ! ( images.isEmpty ( ) ) ) ? images.get ( 0 ) . getStorageIds ( ) . get ( 0 ) : org.ovirt.engine.core.compat.Guid.Empty ; } return storageDomainId ; }
Source:
private boolean staticBootProtoPropertiesChanged ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface existingIface ) { return ( ( iface.getBootProtocol ( ) ) == ( org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol.StaticIp ) ) && ( ( ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getAddress ( ) , existingIface.getAddress ( ) ) ) ) || ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getGateway ( ) , existingIface.getGateway ( ) ) ) ) ) || ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getSubnet ( ) , existingIface.getSubnet ( ) ) ) ) ) ; }

Target:
private boolean staticBootProtoPropertiesChanged ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface existingIface ) { return ( ( iface.getBootProtocol ( ) ) == ( org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol.STATIC_IP ) ) && ( ( ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getAddress ( ) , existingIface.getAddress ( ) ) ) ) || ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getGateway ( ) , existingIface.getGateway ( ) ) ) ) ) || ( ! ( org.apache.commons.lang.ObjectUtils.equals ( iface.getSubnet ( ) , existingIface.getSubnet ( ) ) ) ) ) ; }
Source:
protected void setUpGetEntityExpectations ( int times , boolean notFound , org.ovirt.engine.api.model.StorageDomain entity ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpGetEntityExpectations ( VdcQueryType.GetStorageDomainById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : entity ) ) ; } }

Target:
protected void setUpGetEntityExpectations ( int times , boolean notFound , org.ovirt.engine.api.model.StorageDomain entity ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpGetEntityExpectations ( QueryType.GetStorageDomainById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : entity ) ) ; } }
Source:
public org.ovirt.engine.core.compat.Guid eval ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage ) { return diskImage.getId ( ) ; }

Target:
public java.lang.String buildMetadataDictionaryForTemplate ( org.ovirt.engine.core.common.businessentities.VmTemplate template , java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.compat.KeyValuePairCompat < java.lang.String , java.util.List < org.ovirt.engine.core.compat.Guid > > > metaDictionary ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > allTemplateImages = template.getDiskList ( ) ; java.lang.String templateMeta = generateVmTemplateMetadata ( template , allTemplateImages ) ; metaDictionary.put ( template.getId ( ) , new org.ovirt.engine.core.compat.KeyValuePairCompat ( templateMeta , allTemplateImages.stream ( ) . map ( BaseDisk :: getId ) . collect ( java.util.stream.Collectors.toList ( ) ) ) ) ; return templateMeta ; }
Source:
protected void cretaeVirtIODisk ( ) { org.ovirt.engine.core.common.businessentities.DiskImage disk = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; disk.setImageId ( diskImageGuid ) ; disk.setDiskInterface ( DiskInterface.VirtIO ) ; disk.setactive ( true ) ; org.mockito.Mockito.doReturn ( diskDao ) . when ( command ) . getDiskDao ( ) ; org.mockito.Mockito.when ( diskDao.get ( diskImageGuid ) ) . thenReturn ( disk ) ; mockVmDevice ( true ) ; }

Target:
protected void cretaeVirtIODisk ( ) { org.ovirt.engine.core.common.businessentities.DiskImage disk = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; disk.setImageId ( diskImageGuid ) ; disk.setDiskInterface ( DiskInterface.VirtIO ) ; disk.setActive ( true ) ; org.mockito.Mockito.doReturn ( diskDao ) . when ( command ) . getDiskDao ( ) ; org.mockito.Mockito.when ( diskDao.get ( diskImageGuid ) ) . thenReturn ( disk ) ; mockVmDevice ( true ) ; }