auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public org.ovirt.engine.core.bll.ValidationResult validateNetworkInterfaces ( ) { org.ovirt.engine.core.bll.ValidationResult validationResult = validateInterfacesConfigured ( vm ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } validationResult = validateInterfacesAttachedToClusterNetworks ( vm , getClusterNetworksNames ( ) , getInterfaceNetworkNames ( ) ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } validationResult = validateInterfacesAttachedToVmNetworks ( getClusterNetworks ( ) , getInterfaceNetworkNames ( ) ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult validateNetworkInterfaces ( ) { org.ovirt.engine.core.bll.ValidationResult validationResult = validateInterfacesAttachedToClusterNetworks ( getClusterNetworksNames ( ) , getInterfaceNetworkNames ( ) ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } validationResult = validateInterfacesAttachedToVmNetworks ( getClusterNetworks ( ) , getInterfaceNetworkNames ( ) ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private void initCommand ( org.ovirt.engine.core.common.businessentities.OvfEntityData resultOvfEntityData ) { initUnregisteredOVFData ( resultOvfEntityData ) ; injectorRule.bind ( org.ovirt.engine.core.bll.utils.VmDeviceUtils.class , vmDeviceUtils ) ; org.mockito.Mockito.doReturn ( org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.network.macpool.MacPool.class ) ) . when ( cmd ) . getMacPool ( ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ImportValidator ( cmd.getParameters ( ) ) ) ; org.mockito.Mockito.doReturn ( validator ) . when ( cmd ) . getImportValidator ( ) ; mockStoragePool ( ) ; org.mockito.Mockito.doReturn ( storagePool ) . when ( validator ) . getStoragePool ( ) ; cmd.init ( ) ; }

Target:
private void initCommand ( org.ovirt.engine.core.common.businessentities.OvfEntityData resultOvfEntityData ) { initUnregisteredOVFData ( resultOvfEntityData ) ; org.mockito.Mockito.doReturn ( org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.network.macpool.MacPool.class ) ) . when ( cmd ) . getMacPool ( ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ImportValidator ( cmd.getParameters ( ) ) ) ; org.mockito.Mockito.doReturn ( validator ) . when ( cmd ) . getImportValidator ( ) ; mockStoragePool ( ) ; org.mockito.Mockito.doReturn ( storagePool ) . when ( validator ) . getStoragePool ( ) ; cmd.init ( ) ; }
Source:
public void getDefaultSpmPriority ( 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 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }

Target:
public void getDefaultSpmPriority ( 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 ) ) : 0 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }
Source:
protected org.ovirt.engine.ui.common.widget.table.SimpleActionTable < T > createActionTable ( ) { return new org.ovirt.engine.ui.common.widget.table.SimpleActionTable < T > ( modelProvider , getTableHeaderlessResources ( ) , getTableResources ( ) , org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider.getEventBus ( ) , org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider.getClientStorage ( ) ) { { showRefreshButton ( ) ; showPagingButtons ( ) ; showItemsCount ( ) ; showSelectionCountTooltip ( ) ; enableHeaderContextMenu ( ) ; } } ; }

Target:
protected org.ovirt.engine.ui.common.widget.table.SimpleActionTable < T > createActionTable ( ) { return new org.ovirt.engine.ui.common.widget.table.SimpleActionTable < T > ( modelProvider , getTableResources ( ) , org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider.getEventBus ( ) , org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider.getClientStorage ( ) ) { { showRefreshButton ( ) ; showPagingButtons ( ) ; showItemsCount ( ) ; showSelectionCountTooltip ( ) ; enableHeaderContextMenu ( ) ; } } ; }
Source:
private java.lang.String GetValue ( java.lang.Object obj ) { if ( obj instanceof org.ovirt.engine.core.common.businessentities.VM ) { return ( ( org.ovirt.engine.core.common.businessentities.VM ) ( obj ) ) . getName ( ) ; } if ( obj instanceof org.ovirt.engine.core.common.businessentities.VmPool ) { return ( ( org.ovirt.engine.core.common.businessentities.VmPool ) ( obj ) ) . getName ( ) ; } throw new org.ovirt.engine.core.compat.NotImplementedException ( ) ; }

Target:
private java.lang.String getValue ( java.lang.Object obj ) { if ( obj instanceof org.ovirt.engine.core.common.businessentities.VM ) { return ( ( org.ovirt.engine.core.common.businessentities.VM ) ( obj ) ) . getName ( ) ; } if ( obj instanceof org.ovirt.engine.core.common.businessentities.VmPool ) { return ( ( org.ovirt.engine.core.common.businessentities.VmPool ) ( obj ) ) . getName ( ) ; } throw new org.ovirt.engine.core.compat.NotImplementedException ( ) ; }
Source:
public static < P extends org.ovirt.engine.core.common.action.VdcActionParametersBase > boolean hasConstructor ( org.ovirt.engine.core.common.action.VdcActionType action , P parameters , org.ovirt.engine.core.bll.context.CommandContext cmdContext ) { return ( org.ovirt.engine.core.utils.ReflectionUtils.findConstructor ( org.ovirt.engine.core.bll.CommandsFactory.getCommandClass ( action.name ( ) , org.ovirt.engine.core.bll.CommandsFactory.COMMAND_SUFFIX ) , parameters.getClass ( ) , cmdContext.getClass ( ) ) ) != null ; }

Target:
public static < P extends org.ovirt.engine.core.common.action.VdcActionParametersBase > boolean hasConstructor ( org.ovirt.engine.core.common.action.VdcActionType action , P parameters , org.ovirt.engine.core.bll.context.CommandContext cmdContext ) { return ( org.ovirt.engine.core.utils.ReflectionUtils.findConstructor ( org.ovirt.engine.core.bll.CommandsFactory.getCommandClass ( action.name ( ) ) , parameters.getClass ( ) , cmdContext.getClass ( ) ) ) != null ; }
Source:
public java.util.List < org.ovirt.engine.core.bll.utils.PermissionSubject > getPermissionCheckSubjects ( ) { org.ovirt.engine.core.compat.Guid networkId = ( ( org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) ) == null ) ? null : org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) . getId ( ) ; return java.util.Collections.singletonList ( new org.ovirt.engine.core.bll.utils.PermissionSubject ( networkId , org.ovirt.engine.core.common.VdcObjectType.Network , org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getActionType ( ) . getActionGroup ( ) ) ) ; }

Target:
public java.util.List < org.ovirt.engine.core.bll.utils.PermissionSubject > getPermissionCheckSubjects ( ) { org.ovirt.engine.core.compat.Guid networkId = ( ( getNetwork ( ) ) == null ) ? null : getNetwork ( ) . getId ( ) ; return java.util.Collections.singletonList ( new org.ovirt.engine.core.bll.utils.PermissionSubject ( networkId , org.ovirt.engine.core.common.VdcObjectType.Network , org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getActionType ( ) . getActionGroup ( ) ) ) ; }
Source:
protected void setUpCommand ( ) { org.mockito.Mockito.doNothing ( ) . when ( command ) . initTemplate ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areTemplateImagesInStorageReady ( org.mockito.ArgumentMatchers.any ( ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . verifyAddVm ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateDiskProfiles ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateCpuProfile ( ) ; }

Target:
protected void setUpCommand ( ) { org.mockito.Mockito.doNothing ( ) . when ( command ) . initTemplate ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areTemplateImagesInStorageReady ( org.mockito.ArgumentMatchers.any ( ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateDiskProfiles ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateCpuProfile ( ) ; }
Source:
private void filter ( ) { java.lang.String [ ] ids = this . getParsedId ( ) ; this . filteredId = new java.util.ArrayList < > ( ) ; for ( java.lang.String id : ids ) { if ( ! ( org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.ALL.equals ( id ) ) ) { filteredId.add ( id ) ; } } }

Target:
private void filter ( ) { java.lang.String [ ] ids = this . getParsedId ( ) ; this . filteredId = new java.util.ArrayList < > ( ) ; for ( java.lang.String id : ids ) { if ( ! ( org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.ALL.equals ( id ) ) ) { this . filteredId.add ( id ) ; } } }
Source:
public boolean isStartupTimeoutPassed ( ) { java.util.Date waitTo = getBackend ( ) . getStartedAt ( ) . addSeconds ( ( ( java.lang.Integer ) ( org.ovirt.engine.core.common.config.Config.getValue ( ConfigValues.DisableFenceAtStartupInSec ) ) ) ) ; java.util.Date now = new java.util.Date ( ) ; return ( waitTo.before ( now ) ) || ( waitTo.equals ( now ) ) ; }

Target:
public boolean isStartupTimeoutPassed ( ) { java.util.Date waitTo = getBackend ( ) . getStartedAt ( ) . addSeconds ( org.ovirt.engine.core.common.config.Config.getValue ( ConfigValues.DisableFenceAtStartupInSec ) ) ; java.util.Date now = new java.util.Date ( ) ; if ( ! ( ( waitTo.before ( now ) ) || ( waitTo.equals ( now ) ) ) ) { return false ; } else { return true ; } }
Source:
protected boolean canDoAction ( ) { if ( ( org.ovirt.engine.core.bll.CancelMigrateVmCommand.getVm ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST ) ; return false ; } if ( ( org.ovirt.engine.core.bll.CancelMigrateVmCommand.getVm ( ) . getstatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VMStatus.MigratingFrom ) ) { addCanDoActionMessage ( VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING ) ; return false ; } return true ; }

Target:
protected boolean canDoAction ( ) { if ( ( org.ovirt.engine.core.bll.CancelMigrateVmCommand.getVm ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST ) ; return false ; } if ( ( org.ovirt.engine.core.bll.CancelMigrateVmCommand.getVm ( ) . getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VMStatus.MigratingFrom ) ) { addCanDoActionMessage ( VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING ) ; return false ; } return true ; }
Source:
private void editMacPool ( ) { org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel model = new org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel ( this , org.ovirt.engine.core.common.action.VdcActionType.UpdateMacPool , false ) ; model.setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . editSharedMacPoolTitle ( ) ) ; model.setHashName ( "edit_shared_mac_pool" ) ; model.setHelpTag ( HelpTag.edit_shared_mac_pool ) ; model.setEntity ( ( ( org.ovirt.engine.core.common.businessentities.MacPool ) ( getSelectedItem ( ) ) ) ) ; setWindow ( model ) ; }

Target:
private void editMacPool ( ) { org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel model = new org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel ( this , org.ovirt.engine.core.common.action.VdcActionType.UpdateMacPool ) ; model.setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . editSharedMacPoolTitle ( ) ) ; model.setHashName ( "edit_shared_mac_pool" ) ; model.setHelpTag ( HelpTag.edit_shared_mac_pool ) ; model.setEntity ( ( ( org.ovirt.engine.core.common.businessentities.MacPool ) ( getSelectedItem ( ) ) ) ) ; setWindow ( model ) ; }
Source:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assertEquals ( "" , query ) ; setUpEntityQueryExpectations ( VdcQueryType.GetAllJobs , org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , setUpJobs ( ) , failure ) ; control.replay ( ) ; }

Target:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assertEquals ( "" , query ) ; setUpEntityQueryExpectations ( VdcQueryType.GetAllJobs , org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , setUpJobs ( ) , failure ) ; }
Source:
public org.ovirt.engine.api.model.StorageDomains list ( ) { org.ovirt.engine.api.model.StorageDomains storageDomains = new org.ovirt.engine.api.model.StorageDomains ( ) ; for ( org.ovirt.engine.api.model.StorageDomain entity : getBackendCollection ( org.ovirt.engine.api.model.StorageDomain.class , VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.StoragePoolQueryParametersBase ( dataCenterId ) ) ) { storageDomains.getStorageDomains ( ) . add ( addLinks ( map ( entity ) , getLinksToExclude ( entity ) ) ) ; } return storageDomains ; }

Target:
public org.ovirt.engine.api.model.StorageDomains list ( ) { org.ovirt.engine.api.model.StorageDomains storageDomains = new org.ovirt.engine.api.model.StorageDomains ( ) ; for ( org.ovirt.engine.api.model.StorageDomain entity : getBackendCollection ( org.ovirt.engine.api.model.StorageDomain.class , VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) ) ) { storageDomains.getStorageDomains ( ) . add ( addLinks ( map ( entity ) , getLinksToExclude ( entity ) ) ) ; } return storageDomains ; }
Source:
public static java.lang.String startPasswordDialog ( java.lang.String user , java.lang.String msg ) throws java.io.IOException { org.ovirt.engine.core.config.EngineConfigLogic.log.debug ( "starting password dialog." ) ; java.lang.String prompt = null ; if ( user != null ) { prompt = ( ( msg + " for " ) + user ) + ": " ; } else { prompt = msg + ": " ; } char [ ] passwd = org.ovirt.engine.core.config.EngineConfigLogic.console.readPassword ( prompt ) ; return passwd == null ? "" : new java.lang.String ( passwd ) ; }

Target:
public static java.lang.String startPasswordDialog ( java.lang.String user , java.lang.String msg ) throws java.io.IOException { org.ovirt.engine.core.config.EngineConfigLogic.log.debug ( "starting password dialog." ) ; java.lang.String prompt = null ; if ( user != null ) { prompt = ( ( msg + " for " ) + user ) + ": " ; } else { prompt = msg + ": " ; } return org.ovirt.engine.core.config.EngineConfigLogic.console.readPassword ( prompt ) ; }
Source:
public void setUp ( ) { role = new org.ovirt.engine.core.common.businessentities.Role ( ) ; role.setId ( params.getRoleId ( ) ) ; org.mockito.Mockito.doReturn ( roleDaoMock ) . when ( command ) . getRoleDao ( ) ; org.mockito.Mockito.when ( roleDaoMock.get ( params.getRoleId ( ) ) ) . thenReturn ( role ) ; org.mockito.Mockito.doReturn ( roleGroupMapDaoMock ) . when ( command ) . getRoleGroupMapDao ( ) ; }

Target:
public void setUp ( ) { role = new org.ovirt.engine.core.common.businessentities.Role ( ) ; role.setId ( params.getRoleId ( ) ) ; org.mockito.Mockito.when ( roleDaoMock.get ( params.getRoleId ( ) ) ) . thenReturn ( role ) ; org.mockito.Mockito.doReturn ( roleGroupMapDaoMock ) . when ( command ) . getRoleGroupMapDao ( ) ; }
Source:
public boolean prepareConnectHostToStoragePoolServers ( org.ovirt.engine.core.bll.context.CommandContext cmdContext , org.ovirt.engine.core.common.action.ConnectHostToStoragePoolServersParameters parameters , java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connections ) { if ( isActiveGlusterfsDomainAvailable ( parameters.getStoragePoolId ( ) ) ) { if ( ! ( org.ovirt.engine.core.bll.storage.connection.GLUSTERFSStorageHelper.canVDSConnectToGlusterfs ( parameters.getVds ( ) ) ) ) { org.ovirt.engine.core.bll.storage.connection.GLUSTERFSStorageHelper.log.error ( "Couldn't find glusterfs-cli package on vds (needed for connecting storage domains)." , parameters.getVds ( ) . getName ( ) ) ; setNonOperational ( cmdContext , parameters.getVds ( ) . getId ( ) , NonOperationalReason.VDS_CANNOT_CONNECT_TO_GLUSTERFS ) ; return false ; } } return true ; }

Target:
public boolean prepareConnectHostToStoragePoolServers ( org.ovirt.engine.core.bll.context.CommandContext cmdContext , org.ovirt.engine.core.common.action.ConnectHostToStoragePoolServersParameters parameters , java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connections ) { if ( isActiveGlusterfsDomainAvailable ( parameters.getStoragePoolId ( ) ) ) { if ( ! ( canVDSConnectToGlusterfs ( parameters.getVds ( ) ) ) ) { org.ovirt.engine.core.bll.storage.connection.GLUSTERFSStorageHelper.log.error ( "Couldn't find glusterfs-cli package on vds (needed for connecting storage domains)." , parameters.getVds ( ) . getName ( ) ) ; setNonOperational ( cmdContext , parameters.getVds ( ) . getId ( ) , NonOperationalReason.VDS_CANNOT_CONNECT_TO_GLUSTERFS ) ; return false ; } } return true ; }
Source:
private void mockConfig ( ) { mcr.mockConfigValue ( ConfigValues.InitStorageSparseSizeInGB , 1 ) ; mcr.mockConfigValue ( ConfigValues.ValidNumOfMonitors , java.util.Arrays.asList ( "1,2,4" . split ( "," ) ) ) ; mcr.mockConfigValue ( ConfigValues.IsMigrationSupported , Version.v4_0 , org.ovirt.engine.core.bll.AddVmCommandTest.migrationMap ) ; mcr.mockConfigValue ( ConfigValues.MaxIoThreadsPerVm , 127 ) ; }

Target:
private void mockConfig ( ) { mcr.mockConfigValue ( ConfigValues.ValidNumOfMonitors , java.util.Arrays.asList ( "1,2,4" . split ( "," ) ) ) ; mcr.mockConfigValue ( ConfigValues.IsMigrationSupported , Version.v4_0 , org.ovirt.engine.core.bll.AddVmCommandTest.migrationMap ) ; mcr.mockConfigValue ( ConfigValues.MaxIoThreadsPerVm , 127 ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { validateMemorySize ( getMemSize ( ) , ( ( java.lang.Integer ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) , _minMemSize ) ; if ( ! ( ( ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( model ) ) . getBehavior ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.vms.TemplateVmModelBehavior ) ) { validateMemorySize ( getMinAllocatedMemory ( ) , ( ( java.lang.Integer ) ( getMemSize ( ) . getEntity ( ) ) ) , 1 ) ; } }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { validateMemorySize ( getMemSize ( ) , ( ( java.lang.Integer ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) , _minMemSize ) ; if ( ! ( ( ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( model ) ) . getBehavior ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.vms.TemplateVmModelBehavior ) ) { validateMemorySize ( getMinAllocatedMemory ( ) , getMemSize ( ) . getEntity ( ) , 1 ) ; } }
Source:
java.lang.String getFullPath ( final java.io.File brandingRootPath , final java.lang.String path ) { java.lang.String result = null ; java.lang.String mergedPath = java.nio.file.FileSystems.getDefault ( ) . getPath ( brandingRootPath.getAbsolutePath ( ) , ( path == null ? "" : path ) ) . toString ( ) ; if ( ( path != null ) && ( org.ovirt.engine.core.utils.servlet.ServletUtils.isSane ( mergedPath ) ) ) { result = mergedPath ; } else { org.ovirt.engine.ui.frontend.server.gwt.BrandingServlet.log.error ( ( ( "The path \"" + mergedPath ) + "\" is not sane" ) ) ; } return result ; }

Target:
java.lang.String getFullPath ( final java.io.File brandingRootPath , final java.lang.String path ) { java.lang.String result = null ; java.lang.String mergedPath = new java.io.File ( brandingRootPath.getAbsolutePath ( ) , ( path == null ? "" : path ) ) . getAbsolutePath ( ) ; if ( ( path != null ) && ( org.ovirt.engine.core.utils.servlet.ServletUtils.isSane ( mergedPath ) ) ) { result = mergedPath ; } else { org.ovirt.engine.ui.frontend.server.gwt.BrandingServlet.log.error ( ( ( "The path \"" + mergedPath ) + "\" is not sane" ) ) ; } return result ; }
Source:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 1 , getEntity ( 0 ) ) ; setUpGetStorageServerConnectionExpectations ( 1 ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; org.ovirt.engine.api.model.StorageDomain model = org.ovirt.engine.api.restapi.resource.BackendStorageDomainsResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }

Target:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 1 , getEntity ( 0 ) ) ; setUpGetStorageServerConnectionExpectations ( 1 ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.StorageDomain model = org.ovirt.engine.api.restapi.resource.BackendStorageDomainsResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }
Source:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.ActivateVdsCommand.getVds ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST ) ; returnValue = false ; } if ( ( org.ovirt.engine.core.bll.ActivateVdsCommand.getVds ( ) . getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Up ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP ) ; returnValue = false ; } return returnValue ; }

Target:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.ActivateVdsCommand.getVds ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST ) ; returnValue = false ; } if ( returnValue && ( ( org.ovirt.engine.core.bll.ActivateVdsCommand.getVds ( ) . getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Up ) ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP ) ; returnValue = false ; } return returnValue ; }
Source:
protected org.ovirt.engine.api.model.Disk getEntity ( int index ) { org.ovirt.engine.core.common.businessentities.DiskImage entity = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; entity.setId ( GUIDS [ index ] ) ; entity.setvolume_format ( VolumeFormat.RAW ) ; entity.setDiskInterface ( DiskInterface.VirtIO ) ; entity.setimageStatus ( ImageStatus.OK ) ; entity.setvolume_type ( VolumeType.Sparse ) ; entity.setBoot ( false ) ; entity.setAllowSnapshot ( false ) ; entity.setShareable ( false ) ; entity.setPropagateErrors ( PropagateErrors.On ) ; return org.ovirt.engine.api.restapi.resource.BackendDiskResourceTest.setUpStatisticalEntityExpectations ( entity ) ; }

Target:
protected org.ovirt.engine.api.model.Disk getEntity ( int index ) { org.ovirt.engine.core.common.businessentities.DiskImage entity = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; entity.setId ( GUIDS [ index ] ) ; entity.setvolume_format ( VolumeFormat.RAW ) ; entity.setDiskInterface ( DiskInterface.VirtIO ) ; entity.setimageStatus ( ImageStatus.OK ) ; entity.setvolume_type ( VolumeType.Sparse ) ; entity.setBoot ( false ) ; entity.setShareable ( false ) ; entity.setPropagateErrors ( PropagateErrors.On ) ; return org.ovirt.engine.api.restapi.resource.BackendDiskResourceTest.setUpStatisticalEntityExpectations ( entity ) ; }
Source:
public void validateSufficientSpaceOnDestinationDomains ( ) { setupForStorageTests ( ) ; command.ensureDestinationImageMap ( ) ; org.junit.Assert.assertTrue ( command.checkDestDomains ( ) ) ; org.mockito.Mockito.verify ( multipleSdValidator ) . allDomainsWithinThresholds ( ) ; org.mockito.Mockito.verify ( multipleSdValidator ) . allDomainsHaveSpaceForNewDisks ( org.mockito.ArgumentMatchers.anyList ( ) ) ; }

Target:
public void validateSufficientSpaceOnDestinationDomains ( ) { setupForStorageTests ( ) ; command.ensureDestinationImageMap ( ) ; org.junit.Assert.assertTrue ( command.checkDestDomains ( ) ) ; org.mockito.Mockito.verify ( multipleSdValidator ) . allDomainsWithinThresholds ( ) ; org.mockito.Mockito.verify ( multipleSdValidator ) . allDomainsHaveSpaceForNewDisks ( org.mockito.ArgumentMatchers.any ( ) ) ; }
Source:
public void testGetDataAndSetDataWithSessionParam ( ) { container.SetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE ) ; org.junit.Assert.assertNull ( "Get should return null with an empty session" , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY ) ) ; org.junit.Assert.assertEquals ( "Get should return the value with a given session" , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY ) ) ; }

Target:
public void testGetDataAndSetDataWithSessionParam ( ) { container.SetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE ) ; org.junit.Assert.assertNull ( "Get should return null with an empty session" , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; org.junit.Assert.assertEquals ( "Get should return the value with a given session" , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > getConnections ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connectionsList = new java.util.ArrayList < > ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection1 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection1.setid ( "1cc146e8-e5ed-482c-8814-270bc48c2981" ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection2 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection2.setid ( "2cc146e8-e5ed-482c-8814-270bc48c2981" ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection3 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection3.setid ( "3cc146e8-e5ed-482c-8814-270bc48c2981" ) ; connectionsList.add ( connection1 ) ; connectionsList.add ( connection2 ) ; connectionsList.add ( connection3 ) ; return connectionsList ; }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > getConnections ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connectionsList = new java.util.ArrayList < > ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection1 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection1.setId ( "1cc146e8-e5ed-482c-8814-270bc48c2981" ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection2 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection2.setId ( "2cc146e8-e5ed-482c-8814-270bc48c2981" ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection3 = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection3.setId ( "3cc146e8-e5ed-482c-8814-270bc48c2981" ) ; connectionsList.add ( connection1 ) ; connectionsList.add ( connection2 ) ; connectionsList.add ( connection3 ) ; return connectionsList ; }
Source:
private org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey getModel ( int index ) { org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey model = new org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey ( ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; org.ovirt.engine.api.model.OpenStackVolumeProvider provider = new org.ovirt.engine.api.model.OpenStackVolumeProvider ( ) ; provider.setId ( GUIDS [ 0 ] . toString ( ) ) ; model.setOpenstackVolumeProvider ( provider ) ; model.setUsageType ( OpenstackVolumeAuthenticationKeyUsageType.CEPH.name ( ) ) ; return model ; }

Target:
private org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey getModel ( int index ) { org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey model = new org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey ( ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; org.ovirt.engine.api.model.OpenStackVolumeProvider provider = new org.ovirt.engine.api.model.OpenStackVolumeProvider ( ) ; provider.setId ( GUIDS [ 0 ] . toString ( ) ) ; model.setOpenstackVolumeProvider ( provider ) ; model.setUsageType ( OpenstackVolumeAuthenticationKeyUsageType.CEPH ) ; return model ; }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getDiscoverCommand ( ) ) ) { return discoverNetworkPopupProvider.get ( ) ; } else if ( lastExecutedCommand == ( getModel ( ) . getAddCommand ( ) ) ) { return addNetworkPopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getDiscoverCommand ( ) ) ) { return discoverNetworkPopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }
Source:
private org.ovirt.engine.core.common.action.AddDiskParameters buildAddDiskParameters ( org.ovirt.engine.core.common.businessentities.storage.DiskImage disk ) { org.ovirt.engine.core.common.action.AddDiskParameters parameters = new org.ovirt.engine.core.common.action.AddDiskParameters ( org.ovirt.engine.core.compat.Guid.Empty , disk ) ; parameters.setStorageDomainId ( storageDomainId ) ; parameters.setParentCommand ( enclosingCommand.getActionType ( ) ) ; parameters.setParentParameters ( enclosingCommand.getParameters ( ) ) ; parameters.setShouldBeLogged ( false ) ; return parameters ; }

Target:
private org.ovirt.engine.core.common.action.AddDiskParameters buildAddDiskParameters ( org.ovirt.engine.core.common.businessentities.storage.DiskImage disk ) { org.ovirt.engine.core.common.action.AddDiskParameters parameters = new org.ovirt.engine.core.common.action.AddDiskParameters ( disk ) ; parameters.setStorageDomainId ( storageDomainId ) ; parameters.setParentCommand ( enclosingCommand.getActionType ( ) ) ; parameters.setParentParameters ( enclosingCommand.getParameters ( ) ) ; parameters.setShouldBeLogged ( false ) ; return parameters ; }
Source:
protected boolean registerLibvirtSecrets ( java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets , boolean clearUnusedSecrets ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = runVdsCommand ( VDSCommandType.RegisterLibvirtSecrets , new org.ovirt.engine.core.common.vdscommands.RegisterLibvirtSecretsVDSParameters ( org.ovirt.engine.core.bll.storage.pool.ConnectHostToStoragePoolServerCommandBase.getVdsId ( ) , libvirtSecrets , clearUnusedSecrets ) ) ; if ( ! ( returnValue.getSucceeded ( ) ) ) { auditLogDirector.log ( new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( org.ovirt.engine.core.bll.storage.pool.ConnectHostToStoragePoolServerCommandBase.getVdsId ( ) ) , AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET_ON_VDS ) ; log.error ( "Failed to register libvirt secret on vds {}." , org.ovirt.engine.core.bll.storage.pool.ConnectHostToStoragePoolServerCommandBase.getVds ( ) . getName ( ) ) ; return false ; } return true ; }

Target:
protected boolean registerLibvirtSecrets ( java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets , boolean clearUnusedSecrets ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = runVdsCommand ( VDSCommandType.RegisterLibvirtSecrets , new org.ovirt.engine.core.common.vdscommands.RegisterLibvirtSecretsVDSParameters ( org.ovirt.engine.core.bll.storage.pool.ConnectHostToStoragePoolServerCommandBase.getVdsId ( ) , libvirtSecrets , clearUnusedSecrets ) ) ; if ( ! ( returnValue.getSucceeded ( ) ) ) { auditLogDirector.log ( this , AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET_ON_VDS ) ; log.error ( "Failed to register libvirt secret on vds {}." , org.ovirt.engine.core.bll.storage.pool.ConnectHostToStoragePoolServerCommandBase.getVds ( ) . getName ( ) ) ; return false ; } return true ; }
Source:
public void testRedundantMessages ( ) throws java.io.IOException { org.ovirt.engine.core.utils.EnumTranslationProperties props = new org.ovirt.engine.core.utils.EnumTranslationProperties ( org.ovirt.engine.core.common.errors.EngineMessage.class , org.ovirt.engine.core.common.errors.EngineError.class ) ; try ( java.io.InputStream is = new java.io.FileInputStream ( file ) ) { props.load ( is ) ; } catch ( org.ovirt.engine.core.utils.MissingEnumTranslationException exception ) { org.junit.Assert.fail ( ( ( ( "Check for redundant keys in " + ( file.getAbsolutePath ( ) ) ) + " failed: " ) + ( exception.getMessage ( ) ) ) ) ; } }

Target:
public void testRedundantMessages ( ) throws java.io.IOException { org.ovirt.engine.core.utils.EnumTranslationProperties props = new org.ovirt.engine.core.utils.EnumTranslationProperties ( org.ovirt.engine.core.common.errors.EngineMessage.class ) ; try ( java.io.InputStream is = new java.io.FileInputStream ( file ) ) { props.load ( is ) ; } catch ( org.ovirt.engine.core.utils.MissingEnumTranslationException exception ) { org.junit.Assert.fail ( ( ( ( "Check for redundant keys in " + ( file.getAbsolutePath ( ) ) ) + " failed: " ) + ( exception.getMessage ( ) ) ) ) ; } }
Source:
public org.ovirt.engine.core.searchbackend.IConditionValueAutoCompleter getFieldValueAutoCompleter ( java.lang.String fieldName ) { org.ovirt.engine.core.searchbackend.IConditionValueAutoCompleter retval = null ; if ( org.ovirt.engine.core.compat.StringHelper.EqOp ( fieldName , "OS" ) ) { retval = new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmOsType.class ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.EqOp ( fieldName , "STATUS" ) ) { retval = new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VMStatus.class ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.EqOp ( fieldName , "TYPE" ) ) { retval = new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmType.class ) ; } else { } return retval ; }

Target:
public org.ovirt.engine.core.searchbackend.IConditionValueAutoCompleter getFieldValueAutoCompleter ( java.lang.String fieldName ) { if ( "OS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmOsType.class ) ; } else if ( "STATUS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VMStatus.class ) ; } else if ( "TYPE" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmType.class ) ; } return null ; }
Source:
public boolean isVmStatusQuotaCountable ( org.ovirt.engine.core.common.businessentities.VMStatus status ) { if ( ( nonCountableQutoaVmStatusesList.size ( ) ) == 0 ) { synchronized ( nonCountableQutoaVmStatusesList ) { nonCountableQutoaVmStatusesList.addAll ( org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getQuotaDao ( ) . getNonCountableQutoaVmStatuses ( ) ) ; } } return ! ( nonCountableQutoaVmStatusesList.contains ( status.getValue ( ) ) ) ; }

Target:
public boolean isVmStatusQuotaCountable ( org.ovirt.engine.core.common.businessentities.VMStatus status ) { if ( ( nonCountableQutoaVmStatusesList.size ( ) ) == 0 ) { synchronized ( nonCountableQutoaVmStatusesList ) { nonCountableQutoaVmStatusesList.addAll ( getQuotaDao ( ) . getNonCountableQutoaVmStatuses ( ) ) ; } } return ! ( nonCountableQutoaVmStatusesList.contains ( status.getValue ( ) ) ) ; }
Source:
protected void mockFenceActionResults ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult [ ] results ) { org.mockito.stubbing.OngoingStubbing < org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult > fenceMethodResult = org.mockito.Mockito.when ( fenceAgentExecutor.fence ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.businessentities.pm.FenceActionType.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.businessentities.pm.FenceAgent.class ) ) ) ; for ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult result : results ) { fenceMethodResult = fenceMethodResult.thenReturn ( result ) ; } }

Target:
protected void mockFenceActionResults ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult [ ] results ) { org.mockito.stubbing.OngoingStubbing < org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult > fenceMethodResult = org.mockito.Mockito.when ( fenceAgentExecutor.fence ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ) ; for ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult result : results ) { fenceMethodResult = fenceMethodResult.thenReturn ( result ) ; } }
Source:
protected void updateStorageTypeForDisk ( org.ovirt.engine.api.model.Disk disk ) { org.ovirt.engine.core.compat.Guid storageDomainId = getStorageDomainId ( disk ) ; if ( storageDomainId != null ) { org.ovirt.engine.api.model.StorageDomain storageDomain = getStorageDomainById ( storageDomainId ) ; if ( storageDomain != null ) { disk.setStorageType ( org.ovirt.engine.api.restapi.types.DiskMapper.map ( storageDomain.getStorageDomainType ( ) ) . value ( ) ) ; } } }

Target:
protected void updateStorageTypeForDisk ( org.ovirt.engine.api.model.Disk disk ) { org.ovirt.engine.core.compat.Guid storageDomainId = getStorageDomainId ( disk ) ; if ( storageDomainId != null ) { org.ovirt.engine.api.model.StorageDomain storageDomain = getStorageDomainById ( storageDomainId ) ; if ( storageDomain != null ) { disk.setStorageType ( org.ovirt.engine.api.restapi.types.DiskMapper.map ( storageDomain.getStorageDomainType ( ) ) ) ; } } }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { org.ovirt.engine.ui.uicommonweb.models.SearchableListModel searchableListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.SearchableListModel ) ( model ) ) ; searchableListModel.setItems ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { setItems ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ) ; }
Source:
public void testVMIsNotValid ( ) { setUpGeneralValidations ( ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.FALSE ) . when ( cmd ) . validateVM ( vmValidator ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
public void testVMIsNotValid ( ) { org.mockito.Mockito.doReturn ( java.lang.Boolean.FALSE ) . when ( cmd ) . validateVM ( vmValidator ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }
Source:
private void initSnapshotValidator ( ) { org.mockito.Mockito.when ( snapshotsValidator.vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( snapshotsValidator.vmNotDuringSnapshot ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( command.getSnapshotsValidator ( ) ) . thenReturn ( snapshotsValidator ) ; }

Target:
private void initSnapshotValidator ( ) { org.mockito.Mockito.when ( snapshotsValidator.vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( snapshotsValidator.vmNotDuringSnapshot ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; }
Source:
protected void EndSuccessfully ( ) { org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.EndActionOnDisks ( ) ; if ( ( org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getVm ( ) ) != null ) { org.ovirt.engine.core.bll.VmHandler.unlockVm ( org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getVm ( ) . getDynamicData ( ) , org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getCompensationContext ( ) ) ; restoreVmConfigFromSnapshot ( ) ; } else { org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.setCommandShouldBeLogged ( false ) ; log.warn ( "VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm" ) ; } org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.setSucceeded ( true ) ; }

Target:
protected void EndSuccessfully ( ) { org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.EndActionOnDisks ( ) ; if ( ( org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getVm ( ) ) != null ) { org.ovirt.engine.core.bll.VmHandler.unlockVm ( org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getVm ( ) , org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.getCompensationContext ( ) ) ; restoreVmConfigFromSnapshot ( ) ; } else { org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.setCommandShouldBeLogged ( false ) ; log.warn ( "VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm" ) ; } org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.setSucceeded ( true ) ; }
Source:
private static void addVideoDevice ( org.ovirt.engine.core.common.businessentities.VM vm ) { org.ovirt.engine.core.common.businessentities.VmDevice entity = org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , vm.getId ( ) ) , VmDeviceType.VIDEO , vm.getDefaultDisplayType ( ) . getVmDeviceType ( ) , org.ovirt.engine.core.bll.utils.VmDeviceUtils.getMemExpr ( vm.getNumOfMonitors ( ) ) , true , true ) ; }

Target:
private static void addVideoDevice ( org.ovirt.engine.core.common.businessentities.VM vm ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , vm.getId ( ) ) , VmDeviceType.VIDEO , vm.getDefaultDisplayType ( ) . getVmDeviceType ( ) , org.ovirt.engine.core.bll.utils.VmDeviceUtils.getMemExpr ( vm.getNumOfMonitors ( ) ) , true , true ) ; }
Source:
public void testChangeDiskProfileForDisk ( ) { org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap imageStorageDomainMap = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) . get ( 0 ) ; org.junit.Assert.assertThat ( "Same source and dest disk profile id, cannot perform test" , imageStorageDomainMap.getDiskProfileId ( ) , org.hamcrest.CoreMatchers.not ( org.hamcrest.CoreMatchers.equalTo ( FixturesTool.DISK_PROFILE_2 ) ) ) ; dao.updateDiskProfileByImageGroupIdAndStorageDomainId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_DISK_ID , org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_DOMAIN_ID , FixturesTool.DISK_PROFILE_2 ) ; imageStorageDomainMap = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) . get ( 0 ) ; org.junit.Assert.assertEquals ( "disk profile wasn't changed" , imageStorageDomainMap.getDiskProfileId ( ) , FixturesTool.DISK_PROFILE_2 ) ; }

Target:
public void testChangeDiskProfileForDisk ( ) { org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap imageStorageDomainMap = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) . get ( 0 ) ; org.junit.Assert.assertThat ( "Same source and dest disk profile id, cannot perform test" , imageStorageDomainMap.getDiskProfileId ( ) , org.hamcrest.CoreMatchers.not ( org.hamcrest.CoreMatchers.equalTo ( FixturesTool.DISK_PROFILE_2 ) ) ) ; dao.updateDiskProfileByImageGroupIdAndStorageDomainId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_DISK_ID , org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_DOMAIN_ID , FixturesTool.DISK_PROFILE_2 ) ; imageStorageDomainMap = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) . get ( 0 ) ; org.junit.Assert.assertEquals ( "disk profile wasn't changed" , FixturesTool.DISK_PROFILE_2 , imageStorageDomainMap.getDiskProfileId ( ) ) ; }
Source:
public static org.ovirt.engine.core.common.businessentities.VmDevice addNetworkInterfaceDevice ( org.ovirt.engine.core.common.businessentities.VmDeviceId id , boolean plugged , java.util.Map < java.lang.String , java.lang.String > customProp ) { return org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( id , VmDeviceGeneralType.INTERFACE , VmDeviceType.BRIDGE , java.util.Collections.< java.lang.String , java.lang.Object > emptyMap ( ) , plugged , false , customProp ) ; }

Target:
public static org.ovirt.engine.core.common.businessentities.VmDevice addNetworkInterfaceDevice ( org.ovirt.engine.core.common.businessentities.VmDeviceId id , boolean plugged ) { return org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( id , VmDeviceGeneralType.INTERFACE , VmDeviceType.BRIDGE , java.util.Collections.< java.lang.String , java.lang.Object > emptyMap ( ) , plugged , false , null ) ; }