auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void GetRpmVersionViaPublic ( 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.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunPublicQuery ( VdcQueryType.GetConfigurationValue , new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.ProductRPMVersion , org.ovirt.engine.core.common.config.Config.DefaultConfigurationVersion ) , 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.RunQuery ( VdcQueryType.GetPermissionsByAdElementId , new org.ovirt.engine.core.common.queries.MultilevelAdministrationByAdElementIdParameters ( userId ) , aQuery ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService insertTestService ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService service = new org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService ( ) ; service.setId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.NEW_SERVICE_ID ) ) ; service.setServerId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVER1_ID ) ) ; service.setServiceId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE2_ID ) ) ; service.setServiceType ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE2_TYPE ) ; service.setStatus ( GlusterServiceStatus.FAILED ) ; service.setMessage ( "test message" ) ; service.setPid ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.NEW_PID ) ; dao.save ( service ) ; return service ; }

Target:
private org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService insertTestService ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService service = new org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService ( ) ; service.setId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.NEW_SERVICE_ID ) ) ; service.setServerId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVER1_ID ) ) ; service.setServiceId ( org.ovirt.engine.core.compat.Guid.createGuidFromString ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE2_ID ) ) ; service.setServiceType ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE2_TYPE ) ; service.setStatus ( GlusterServiceStatus.UNKNOWN ) ; service.setMessage ( "test message" ) ; service.setPid ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.NEW_PID ) ; service.setHostName ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.VDS_NAME1 ) ; dao.save ( service ) ; return service ; }
Source:
public static void getAllAttachableDisks ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ( ) ; } } ; org.ovirt.engine.core.common.queries.GetAllAttachableDisks params = new org.ovirt.engine.core.common.queries.GetAllAttachableDisks ( storagePoolId ) ; params.setVmId ( vmId ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllAttachableDisks , params , aQuery ) ; }

Target:
public static void getVmsRunningOnOrMigratingToVds ( 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 ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VM > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmsRunningOnOrMigratingToVds , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }
Source:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { return org.ovirt.engine.core.bll.AddUserProfileCommand.getSucceeded ( ) ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_PROFILE : org.ovirt.engine.core.common.AuditLogType.USER_ADD_PROFILE_FAILED ; }

Target:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { org.ovirt.engine.core.common.businessentities.UserProfile existingProfile = org.ovirt.engine.core.bll.AddUserProfileCommand.getUserProfile ( ) ; if ( existingProfile != null ) { return org.ovirt.engine.core.bll.AddUserProfileCommand.getSucceeded ( ) ? org.ovirt.engine.core.common.AuditLogType.USER_UPDATE_PROFILE : org.ovirt.engine.core.common.AuditLogType.USER_UPDATE_PROFILE_FAILED ; } else { return org.ovirt.engine.core.bll.AddUserProfileCommand.getSucceeded ( ) ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_PROFILE : org.ovirt.engine.core.common.AuditLogType.USER_ADD_PROFILE_FAILED ; } }
Source:
public static org.ovirt.engine.api.model.Statistic setDatum ( org.ovirt.engine.api.model.Statistic statistic , java.math.BigDecimal datum ) { statistic.getValues ( ) . getValues ( ) . get ( 0 ) . setDatum ( datum ) ; return statistic ; }

Target:
public static org.ovirt.engine.api.model.Statistic setDatum ( org.ovirt.engine.api.model.Statistic statistic , java.math.BigDecimal datum ) { if ( datum != null ) { org.ovirt.engine.api.model.Value value = new org.ovirt.engine.api.model.Value ( ) ; value.setDatum ( datum ) ; statistic.getValues ( ) . getValues ( ) . add ( value ) ; } return statistic ; }
Source:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.ConsolePopupModel model ) { this . model = model ; org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel defaultConsole = model.getModel ( ) . getDefaultConsoleModel ( ) ; editCheckBoxes ( defaultConsole , ctrlAltDel , enableUsbAutoshare , openInFullScreen , wanEnabled , disableSmartcard ) ; org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel additionalConsole = model.getModel ( ) . getAdditionalConsoleModel ( ) ; editCheckBoxes ( additionalConsole , useLocalDrives ) ; }

Target:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.ConsolePopupModel model ) { this . model = model ; org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel defaultConsole = model.getModel ( ) . getDefaultConsoleModel ( ) ; editCheckBoxes ( defaultConsole , ctrlAltDel , enableUsbAutoshare , openInFullScreen , enableSpiceProxy , wanEnabled , disableSmartcard ) ; org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel additionalConsole = model.getModel ( ) . getAdditionalConsoleModel ( ) ; editCheckBoxes ( additionalConsole , useLocalDrives ) ; }
Source:
public void onFailure ( final java.lang.Throwable caught ) { if ( ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to execute logoff: " + caught ) , caught ) ; getEventsHandler ( ) . runQueryFailed ( null ) ; failureEventHandler ( caught ) ; callback.getDel ( ) . onSuccess ( callback.getModel ( ) , null ) ; }

Target:
public void onFailure ( final org.ovirt.engine.ui.frontend.communication.VdcOperation < org.ovirt.engine.core.common.action.VdcActionType , org.ovirt.engine.core.common.action.LoginUserParameters > operation , final java.lang.Throwable caught ) { if ( ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to login: " + caught ) , caught ) ; getEventsHandler ( ) . runQueryFailed ( null ) ; failureEventHandler ( caught ) ; if ( callback.isHandleFailure ( ) ) { setLoggedInUser ( null ) ; callback.getDel ( ) . onSuccess ( callback.getModel ( ) , null ) ; } }
Source:
public void testAddIncompleteParameters2 ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Disk model = org.ovirt.engine.api.restapi.resource.BackendVmDisksResourceTest.getModel ( ) ; model.setProvisionedSize ( null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Disk" , "testAddIncompleteParameters2" , "provisionedSize|size" ) ; } }

Target:
public void testAddLunDiskMissingType ( ) { org.ovirt.engine.api.model.Disk model = createIscsiLunDisk ( ) ; model.getLunStorage ( ) . setType ( null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; org.junit.Assert.fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "HostStorage" , "testAddLunDiskMissingType" , "type" ) ; } }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { java.lang.String propName = ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) . PropertyName ; if ( ( ( "CpuUsage" . equals ( propName ) ) || ( "MemoryUsage" . equals ( propName ) ) ) || ( "NetworkUsage" . equals ( propName ) ) ) { org.ovirt.engine.ui.userportal.uicommon.model.vm.VmMonitorValueChangeEvent.fire ( getEventBus ( ) ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { java.lang.String propName = ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) . propertyName ; if ( ( ( "CpuUsage" . equals ( propName ) ) || ( "MemoryUsage" . equals ( propName ) ) ) || ( "NetworkUsage" . equals ( propName ) ) ) { org.ovirt.engine.ui.userportal.uicommon.model.vm.VmMonitorValueChangeEvent.fire ( getEventBus ( ) ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getVdcOptionDAO ( ) ) ; existingOption = dao.getByNameAndVersion ( "UserDefinedVmPropertiesKey1" , "general" ) ; newOption = new org.ovirt.engine.core.common.businessentities.VdcOption ( ) ; newOption.setoption_name ( "option_name" ) ; newOption.setoption_value ( "option_value" ) ; newOption.setversion ( "general" ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getVdcOptionDao ( ) ) ; existingOption = dao.getByNameAndVersion ( "UserDefinedVmPropertiesKey1" , "general" ) ; newOption = new org.ovirt.engine.core.common.businessentities.VdcOption ( ) ; newOption.setoption_name ( "option_name" ) ; newOption.setoption_value ( "option_value" ) ; newOption.setversion ( "general" ) ; }
Source:
private boolean isTemplateInDestStorageDomain ( org.ovirt.engine.core.compat.Guid imageId , org.ovirt.engine.core.compat.Guid sourceDomainId ) { org.ovirt.engine.core.compat.Guid templateId = getDiskImageById ( imageId ) . getImageTemplateId ( ) ; if ( ! ( Guid.Empty.equals ( templateId ) ) ) { org.ovirt.engine.core.common.businessentities.DiskImage templateImage = getDiskImageDao ( ) . get ( templateId ) ; if ( ! ( templateImage.getStorageIds ( ) . contains ( sourceDomainId ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_DESTINATION_DOMAIN ) ; } } return true ; }

Target:
private boolean isTemplateInDestStorageDomain ( org.ovirt.engine.core.compat.Guid imageId , org.ovirt.engine.core.compat.Guid sourceDomainId ) { org.ovirt.engine.core.compat.Guid templateId = getDiskImageByImageId ( imageId ) . getImageTemplateId ( ) ; if ( ! ( Guid.Empty.equals ( templateId ) ) ) { org.ovirt.engine.core.common.businessentities.DiskImage templateImage = getDiskImageDao ( ) . get ( templateId ) ; if ( ! ( templateImage.getStorageIds ( ) . contains ( sourceDomainId ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_DESTINATION_DOMAIN ) ; } } return true ; }
Source:
public void testGetWithInvalidNetworkId ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetIscsiBondById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendIscsiBondNetworkResourceTest.ISCSI_BOND_ID } , getIscsiBondWithNoMatchingNetworks ( ) ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testGetWithInvalidNetworkId ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 , getIscsiBondWithNoMatchingNetworks ( ) ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = ( ( org.ovirt.engine.core.common.businessentities.VDSGroup ) ( returnValue ) ) ; if ( ( ( cluster != null ) && ( cluster.supportsGlusterService ( ) ) ) && ( ! ( cluster.supportsVirtService ( ) ) ) ) { model.getForce ( ) . setIsAvailable ( true ) ; } model.stopProgress ( ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.core.common.businessentities.Cluster cluster = ( ( org.ovirt.engine.core.common.businessentities.Cluster ) ( returnValue ) ) ; if ( ( cluster != null ) && ( cluster.supportsGlusterService ( ) ) ) { model.getForce ( ) . setIsAvailable ( true ) ; } model.stopProgress ( ) ; }
Source:
private boolean isStorageDomainValid ( org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.common.businessentities.FileTypeExtension fileTypeExtension , boolean forceRefresh ) { if ( storageDomainId == null ) { org.ovirt.engine.core.bll.IsoDomainListSyncronizer.log.error ( "Storage domain ID received from command query is null." ) ; return false ; } if ( ! ( refreshRepos ( storageDomainId , fileTypeExtension , forceRefresh ) ) ) { return false ; } return true ; }

Target:
private boolean isStorageDomainValid ( org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.common.businessentities.ImageType imageType , boolean forceRefresh ) { if ( storageDomainId == null ) { org.ovirt.engine.core.bll.IsoDomainListSyncronizer.log.error ( "Storage domain ID received from command query is null." ) ; return false ; } if ( ! ( refreshRepos ( storageDomainId , imageType , forceRefresh ) ) ) { return false ; } return true ; }
Source:
public boolean StorageDomainRemoved ( org.ovirt.engine.core.common.businessentities.storage_domain_static storageDomain ) { java.util.List < org.ovirt.engine.core.common.businessentities.LUNs > lunsList = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getLunDao ( ) . getAllForVolumeGroup ( storageDomain.getstorage ( ) ) ; if ( ( lunsList.size ( ) ) != 0 ) { for ( org.ovirt.engine.core.common.businessentities.LUNs lun : lunsList ) { org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getLunDao ( ) . remove ( lun.getLUN_id ( ) ) ; } } return true ; }

Target:
public boolean StorageDomainRemoved ( org.ovirt.engine.core.common.businessentities.storage_domain_static storageDomain ) { removeStorageDomainLuns ( storageDomain ) ; return true ; }
Source:
public org.ovirt.engine.ui.common.uicommon.model.SearchableDetailModelProvider < org.ovirt.engine.core.common.businessentities.AuditLog , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterListModel , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterEventListModel > getDataCenterEventListProvider ( org.ovirt.engine.ui.webadmin.gin.ClientGinjector ginjector ) { return new org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider < org.ovirt.engine.core.common.businessentities.AuditLog , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterListModel , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterEventListModel > ( ginjector , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterListModel.class , org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterEventListModel.class ) ; }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterEventListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand.equals ( getModel ( ) . getDetailsCommand ( ) ) ) { return eventPopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }
Source:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > disks = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( returnValue ) ) ; java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel > diskModels = org.ovirt.engine.ui.uicommonweb.Linq.DisksToDiskModelList ( disks ) ; model.getExternalAttachableDisks ( ) . setItems ( org.ovirt.engine.ui.uicommonweb.Linq.ToEntityModelList ( org.ovirt.engine.ui.uicommonweb.Linq.FilterDisksByType ( diskModels , DiskStorageType.LUN ) ) ) ; }

Target:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > disks = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( returnValue ) ) ; org.ovirt.engine.ui.uicommonweb.Linq.Sort ( disks , new org.ovirt.engine.ui.uicommonweb.Linq.DiskByAliasComparer ( ) ) ; java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel > diskModels = org.ovirt.engine.ui.uicommonweb.Linq.DisksToDiskModelList ( disks ) ; model.getExternalAttachableDisks ( ) . setItems ( org.ovirt.engine.ui.uicommonweb.Linq.ToEntityModelList ( org.ovirt.engine.ui.uicommonweb.Linq.FilterDisksByType ( diskModels , DiskStorageType.LUN ) ) ) ; }
Source:
private org.ovirt.engine.core.bll.network.macpoolmanager.Range findRangeWithAvailableMac ( int startIndex , int endIndex , int numberOfRanges ) { for ( int i = startIndex ; i < endIndex ; i ++ ) { org.ovirt.engine.core.bll.network.macpoolmanager.Range range = ranges.get ( i ) ; boolean hasAvailableMacs = ( range.getAvailableCount ( ) ) > 0 ; if ( hasAvailableMacs ) { startIndexForEmptyRangeSearch = ( i + 1 ) % numberOfRanges ; return range ; } } return null ; }

Target:
private org.ovirt.engine.core.bll.network.macpool.Range findRangeWithAvailableMac ( int startIndex , int endIndex , int numberOfRanges ) { for ( int i = startIndex ; i < endIndex ; i ++ ) { org.ovirt.engine.core.bll.network.macpool.Range range = ranges.get ( i ) ; boolean hasAvailableMacs = ( range.getAvailableCount ( ) ) > 0 ; if ( hasAvailableMacs ) { startIndexForEmptyRangeSearch = ( i + 1 ) % numberOfRanges ; return range ; } } return null ; }
Source:
public static java.lang.String getTokenInstance ( java.lang.String content ) { return java.lang.String.format ( "0|%s" , content ) ; }

Target:
public static boolean isStatusOk ( java.util.Map < java.lang.String , java.lang.Object > response ) { if ( ( response.get ( "error" ) ) != null ) { throw new java.lang.RuntimeException ( java.lang.String.format ( "%s: %s" , response.get ( "error_code" ) , response.get ( "error" ) ) ) ; } return true ; }
Source:
private org.ovirt.engine.core.bll.network.host.SetupNetworksHelper qosCommitmentBondSetup ( int totalCommitment , java.lang.Integer slaveSpeed , java.lang.Integer bondSpeed , java.lang.String bondOptions ) { return qosCommitmentSetup ( true , totalCommitment , slaveSpeed , bondSpeed , bondOptions ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { effectiveHostNetworkQos = new org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos ( qosDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.NetworkDao.class , networkDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.NetworkAttachmentDao.class , networkAttachmentDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.InterfaceDao.class , interfaceDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.gluster.GlusterBrickDao.class , brickDao ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos.class , effectiveHostNetworkQos ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.NetworkImplementationDetailsUtils.class , new org.ovirt.engine.core.vdsbroker.NetworkImplementationDetailsUtils ( effectiveHostNetworkQos , networkAttachmentDao , calculateBaseNic ) ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.CalculateBaseNic.class , calculateBaseNic ) ; }
Source:
public static void getExistingStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.common.businessentities.StorageDomainType domainType , org.ovirt.engine.core.common.businessentities.StorageType storageType , java.lang.String path ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( hostId , storageType , domainType , path ) , aQuery ) ; }

Target:
public static void getStorageDomainMaxNameLength ( 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 ( ) : 1 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.StorageDomainNameSizeLimit , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
private static boolean isDiskOrInterface ( org.ovirt.engine.core.common.businessentities.VmDevice vmDevice ) { return ( org.ovirt.engine.core.common.utils.VmDeviceCommonUtils.isDisk ( vmDevice ) ) || ( ( vmDevice.getDevice ( ) . equals ( VmDeviceType.BRIDGE.getName ( ) ) ) && ( ( vmDevice.getType ( ) ) == ( org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType.INTERFACE ) ) ) ; }

Target:
private static boolean isDiskOrInterface ( org.ovirt.engine.core.common.businessentities.VmDevice vmDevice ) { return ( org.ovirt.engine.core.common.utils.VmDeviceCommonUtils.isDisk ( vmDevice ) ) || ( org.ovirt.engine.core.common.utils.VmDeviceCommonUtils.isBridge ( vmDevice ) ) ; }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getManageEventsCommand ( ) ) ) { ManageEvents ( ) ; } if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnSave" ) ) { OnSave ( ) ; } if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "Cancel" ) ) { Cancel ( ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getManageEventsCommand ( ) ) ) { manageEvents ( ) ; } if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "OnSave" ) ) { onSave ( ) ; } if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "Cancel" ) ) { cancel ( ) ; } }
Source:
private static org.ovirt.engine.core.common.businessentities.StoragePool createDefaultStoragePool ( ) { org.ovirt.engine.core.common.businessentities.StoragePool pool = org.ovirt.engine.core.bll.storage.UpdateStoragePoolCommandTest.createBasicPool ( ) ; pool.setIsLocal ( true ) ; pool.setcompatibility_version ( org.ovirt.engine.core.bll.storage.UpdateStoragePoolCommandTest.VERSION_1_1 ) ; return pool ; }

Target:
private void addDefaultClusterToPool ( ) { org.ovirt.engine.core.common.businessentities.VDSGroup defaultCluster = new org.ovirt.engine.core.common.businessentities.VDSGroup ( ) ; defaultCluster.setCompatibilityVersion ( org.ovirt.engine.core.bll.storage.UpdateStoragePoolCommandTest.VERSION_1_1 ) ; defaultCluster.setId ( org.ovirt.engine.core.bll.storage.UpdateStoragePoolCommandTest.DEFAULT_VDS_GROUP_ID ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > clusters = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ( ) ; clusters.add ( defaultCluster ) ; org.mockito.Mockito.when ( vdsGroupDao.getAllForStoragePool ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( clusters ) ; }
Source:
public void qosNotSupported ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = createManagementNetwork ( ) ; mockExistingNetworks ( network ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNicSyncedWithNetwork ( "eth0" , network ) ; mockExistingIfaces ( iface ) ; iface.setQosOverridden ( true ) ; iface.setQos ( createQos ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( iface ) ) ; validateAndExpectViolation ( helper , EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_NOT_SUPPORTED , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { effectiveHostNetworkQos = new org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos ( qosDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.NetworkDao.class , networkDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.NetworkAttachmentDao.class , networkAttachmentDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.network.InterfaceDao.class , interfaceDao ) ; injectorRule.bind ( org.ovirt.engine.core.dao.gluster.GlusterBrickDao.class , brickDao ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos.class , effectiveHostNetworkQos ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.NetworkImplementationDetailsUtils.class , new org.ovirt.engine.core.vdsbroker.NetworkImplementationDetailsUtils ( effectiveHostNetworkQos , networkAttachmentDao , calculateBaseNic ) ) ; injectorRule.bind ( org.ovirt.engine.core.vdsbroker.CalculateBaseNic.class , calculateBaseNic ) ; }
Source:
private static org.ovirt.engine.core.common.businessentities.storage.RepoImage getNewIsoRepoFile ( ) { org.ovirt.engine.core.common.businessentities.storage.RepoImage newRepoFileMap = new org.ovirt.engine.core.common.businessentities.storage.RepoImage ( ) ; newRepoFileMap.setFileType ( ImageFileType.ISO ) ; newRepoFileMap.setRepoImageId ( "isoDomain.iso" ) ; newRepoFileMap.setLastRefreshed ( java.lang.System.currentTimeMillis ( ) ) ; newRepoFileMap.setSize ( null ) ; newRepoFileMap.setDateCreated ( null ) ; newRepoFileMap.setRepoDomainId ( FixturesTool.STORAGE_DOAMIN_NFS_ISO ) ; return newRepoFileMap ; }

Target:
private static org.ovirt.engine.core.common.businessentities.storage.RepoImage getNewIsoRepoFile ( ) { org.ovirt.engine.core.common.businessentities.storage.RepoImage newRepoFileMap = new org.ovirt.engine.core.common.businessentities.storage.RepoImage ( ) ; newRepoFileMap.setFileType ( ImageFileType.ISO ) ; newRepoFileMap.setRepoImageId ( "isoDomain.iso" ) ; newRepoFileMap.setLastRefreshed ( java.lang.System.currentTimeMillis ( ) ) ; newRepoFileMap.setSize ( null ) ; newRepoFileMap.setDateCreated ( null ) ; newRepoFileMap.setRepoDomainId ( FixturesTool.STORAGE_DOMAIN_NFS_ISO ) ; return newRepoFileMap ; }
Source:
public void testUpdateAll ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic existingEntity2 = dao.get ( new org.ovirt.engine.core.compat.Guid ( "42058975-3d5e-484a-80c1-01c31207f579" ) ) ; existingEntity.setActualSize ( 100 ) ; existingEntity2.setReadRate ( 120 ) ; existingEntity.setReadLatency ( 100.0 ) ; existingEntity2.setReadLatency ( 1.0E-5 ) ; dao.updateAll ( java.util.Arrays.asList ( existingEntity , existingEntity2 ) ) ; org.junit.Assert.assertEquals ( existingEntity , dao.get ( existingEntity.getId ( ) ) ) ; org.junit.Assert.assertEquals ( existingEntity2 , dao.get ( existingEntity2.getId ( ) ) ) ; }

Target:
public void testUpdateAll ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic existingEntity2 = dao.get ( new org.ovirt.engine.core.compat.Guid ( "42058975-3d5e-484a-80c1-01c31207f579" ) ) ; existingEntity.setActualSize ( 100 ) ; existingEntity2.setReadRate ( 120 ) ; existingEntity.setReadLatency ( 100.0 ) ; existingEntity2.setReadLatency ( 1.0E-5 ) ; dao.updateAll ( java.util.Arrays.asList ( existingEntity , existingEntity2 ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( existingEntity , dao.get ( existingEntity.getId ( ) ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( existingEntity2 , dao.get ( existingEntity2.getId ( ) ) ) ; }
Source:
public void onFailed ( ) { updateEntityPhase ( ImageTransferPhase.FINISHED_FAILURE ) ; log.debug ( "Removing ImageTransfer id {}" , org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; imageTransferDao.remove ( org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.endWithFailure ( ) ; log.error ( "Failed to transfer. (command id '{}')" , getTransferDescription ( ) , org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; }

Target:
public void onFailed ( ) { updateEntityPhase ( ImageTransferPhase.FINISHED_FAILURE ) ; log.debug ( "Removing ImageTransfer id {}" , org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; imageTransferDao.remove ( org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.endWithFailure ( ) ; log.error ( "Failed to transfer disk '{}' (command id '{}')" , org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getParameters ( ) . getImageId ( ) , org.ovirt.engine.core.bll.storage.disk.image.TransferImageCommand.getCommandId ( ) ) ; }
Source:
protected boolean canDoAction ( ) { final org.ovirt.engine.core.common.businessentities.VM vm = org.ovirt.engine.core.bll.FreezeVmCommand.getVm ( ) ; if ( vm == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND ) ; } if ( ! ( org.ovirt.engine.core.bll.FreezeVmCommand.canRunActionOnNonManagedVm ( ) ) ) { return false ; } if ( ( org.ovirt.engine.core.bll.FreezeVmCommand.getVm ( ) . getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VMStatus.Up ) ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL , org.ovirt.engine.core.bll.validator.LocalizedVmStatus.from ( vm.getStatus ( ) ) ) ; } return true ; }

Target:
protected boolean canDoAction ( ) { final org.ovirt.engine.core.common.businessentities.VM vm = org.ovirt.engine.core.bll.FreezeVmCommand.getVm ( ) ; if ( vm == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND ) ; } if ( ! ( org.ovirt.engine.core.bll.FreezeVmCommand.canRunActionOnNonManagedVm ( ) ) ) { return false ; } if ( ( org.ovirt.engine.core.bll.FreezeVmCommand.getVm ( ) . getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VMStatus.Up ) ) { return org.ovirt.engine.core.bll.FreezeVmCommand.failVmStatusIllegal ( ) ; } return true ; }
Source:
protected void doTestBadRemove ( boolean valid , boolean success , java.lang.String detail ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( VdcActionType.RemoveVmNicFilterParameter , org.ovirt.engine.core.common.action.RemoveVmNicFilterParameterParameters.class , new java.lang.String [ ] { "VmId" , "FilterParameterId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmNicFilterParameterResourceTest.VM_ID , org.ovirt.engine.api.restapi.resource.BackendVmNicFilterParameterResourceTest.PARAMETER_ID } , valid , success ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }

Target:
protected void doTestBadRemove ( boolean valid , boolean success , java.lang.String detail ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( ActionType.RemoveVmNicFilterParameter , org.ovirt.engine.core.common.action.RemoveVmNicFilterParameterParameters.class , new java.lang.String [ ] { "VmId" , "FilterParameterId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmNicFilterParameterResourceTest.VM_ID , org.ovirt.engine.api.restapi.resource.BackendVmNicFilterParameterResourceTest.PARAMETER_ID } , valid , success ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }
Source:
public void getStorageDevices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterStorageDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , aQuery ) ; }

Target:
public void getStorageConnectionsByDataCenterIdAndStorageType ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.core.common.queries.GetConnectionsByDataCenterAndStorageTypeParameters params = new org.ovirt.engine.core.common.queries.GetConnectionsByDataCenterAndStorageTypeParameters ( storagePoolId , storageType ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetConnectionsByDataCenterAndStorageType , params , aQuery ) ; }
Source:
public void bondWithNoNetworkDidntChange ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond = createBond ( null ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ifaces = createBondSlaves ( bond.getName ( ) ) ; mockExistingIfacesWithBond ( bond , ifaces ) ; org.ovirt.engine.core.common.action.SetupNetworksParameters parameters = new org.ovirt.engine.core.common.action.SetupNetworksParameters ( ) ; ifaces.add ( bond ) ; parameters.setInterfaces ( ifaces ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( parameters ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNoBondsRemoved ( helper ) ; assertNoNetworksRemoved ( helper ) ; }

Target:
public void bondWithNetworkDidntChange ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond = createBond ( org.ovirt.engine.core.bll.SetupNetworksHelperTest.BOND_NAME , "net" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ifaces = createNics ( bond.getName ( ) ) ; mockExistingIfacesWithBond ( bond , ifaces ) ; org.ovirt.engine.core.common.action.SetupNetworksParameters parameters = new org.ovirt.engine.core.common.action.SetupNetworksParameters ( ) ; ifaces.add ( bond ) ; parameters.setInterfaces ( ifaces ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( parameters ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNoBondsRemoved ( helper ) ; assertNoNetworksRemoved ( helper ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > getRepoListForStorageDomainAndStoragePool ( org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.common.businessentities.FileTypeExtension fileType ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "storage_pool_id" , storagePoolId ) ; parameterSource.addValue ( "storage_domain_id" , storageDomainId ) ; parameterSource.addValue ( "file_type" , fileType.getValue ( ) ) ; return getCallsHandler ( ) . executeReadList ( "GetRepo_files_by_storage_domain_and_storage_pool" , org.ovirt.engine.core.dao.RepoFileMetaDataDAODbFacadeImpl.StorageDomainRepoFileMetaDataMapper.instance , parameterSource ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > getRepoListForStorageDomainAndStoragePool ( org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.common.businessentities.ImageType fileType ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "storage_pool_id" , storagePoolId ) ; parameterSource.addValue ( "storage_domain_id" , storageDomainId ) ; parameterSource.addValue ( "file_type" , fileType.getValue ( ) ) ; return getCallsHandler ( ) . executeReadList ( "GetRepo_files_by_storage_domain_and_storage_pool" , org.ovirt.engine.core.dao.RepoFileMetaDataDAODbFacadeImpl.StorageDomainRepoFileMetaDataMapper.instance , parameterSource ) ; }
Source:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( QueryType.GetVmByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.VM_ID } , null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( QueryType.GetVmByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.VM_ID } , null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { resource.remove ( ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { org.junit.Assert.assertNotNull ( wae.getResponse ( ) ) ; org.junit.Assert.assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }
Source:
public void isConnWithSameDetailsExistSameConnection ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections newNFSConnection = createNFSConnection ( "multipass.my.domain.tlv.company.com:/export/allstorage/data2" , StorageType.NFS , NfsVersion.V4 , 300 , 0 ) ; java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connections = new java.util.ArrayList < > ( ) ; connections.add ( newNFSConnection ) ; org.mockito.Mockito.when ( storageConnDao.getAllForStorage ( newNFSConnection.getConnection ( ) ) ) . thenReturn ( connections ) ; boolean isExists = command.isConnWithSameDetailsExists ( newNFSConnection , null ) ; org.junit.Assert.assertFalse ( isExists ) ; }

Target:
public void isConnWithSameDetailsExistNoConnections ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections newNFSConnection = createNFSConnection ( "multipass.my.domain.tlv.company.com:/export/allstorage/data2" , StorageType.NFS , NfsVersion.V4 , 300 , 0 ) ; java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connections = java.util.Collections.emptyList ( ) ; org.mockito.Mockito.when ( storageConnDao.getAllForStorage ( newNFSConnection.getConnection ( ) ) ) . thenReturn ( connections ) ; boolean isExists = command.isConnWithSameDetailsExists ( newNFSConnection , null ) ; org.junit.Assert.assertFalse ( isExists ) ; }
Source:
public static void getGlusterHook ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hookId , boolean includeServerHooks ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterHookById , new org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters ( hookId , includeServerHooks ) , aQuery ) ; }

Target:
public void getGlusterBricksForServer ( 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.GlusterBrickEntity > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeBricksByServerId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( serverId ) , aQuery ) ; }
Source:
public org.ovirt.engine.core.common.businessentities.VmDevice addDiskDevice ( org.ovirt.engine.core.compat.Guid vmId , org.ovirt.engine.core.compat.Guid deviceId , java.lang.Boolean isPlugged , java.lang.Boolean isReadOnly , java.lang.String address , boolean isUsingScsiReservation ) { return addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( deviceId , vmId ) , VmDeviceGeneralType.DISK , VmDeviceType.DISK , org.ovirt.engine.core.bll.utils.VmDeviceUtils.EMPTY_SPEC_PARAMS , isPlugged , isReadOnly , address , null , isUsingScsiReservation ) ; }

Target:
public org.ovirt.engine.core.common.businessentities.VmDevice addDiskDevice ( org.ovirt.engine.core.compat.Guid vmId , org.ovirt.engine.core.compat.Guid deviceId , java.lang.Boolean isPlugged , java.lang.Boolean isReadOnly , java.lang.String address , boolean isUsingScsiReservation ) { return addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( deviceId , vmId ) , VmDeviceGeneralType.DISK , VmDeviceType.DISK , java.util.Collections.emptyMap ( ) , isPlugged , isReadOnly , address , null , isUsingScsiReservation ) ; }
Source:
private void executeFenceVdsManuallyAction ( final org.ovirt.engine.core.compat.Guid vdsId , java.lang.String sessionId ) { org.ovirt.engine.core.common.action.FenceVdsManualyParameters fenceVdsManuallyParams = new org.ovirt.engine.core.common.action.FenceVdsManualyParameters ( false ) ; fenceVdsManuallyParams.setStoragePoolId ( org.ovirt.engine.core.bll.RestartVdsCommand.getVds ( ) . getStoragePoolId ( ) ) ; fenceVdsManuallyParams.setVdsId ( vdsId ) ; fenceVdsManuallyParams.setSessionId ( sessionId ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.FenceVdsManualy , fenceVdsManuallyParams ) ; }

Target:
private void executeFenceVdsManuallyAction ( final org.ovirt.engine.core.compat.Guid vdsId , java.lang.String sessionId ) { org.ovirt.engine.core.common.action.FenceVdsManualyParameters fenceVdsManuallyParams = new org.ovirt.engine.core.common.action.FenceVdsManualyParameters ( false ) ; fenceVdsManuallyParams.setStoragePoolId ( org.ovirt.engine.core.bll.RestartVdsCommand.getVds ( ) . getStoragePoolId ( ) ) ; fenceVdsManuallyParams.setVdsId ( vdsId ) ; fenceVdsManuallyParams.setSessionId ( sessionId ) ; fenceVdsManuallyParams.setParentCommand ( VdcActionType.RestartVds ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.FenceVdsManualy , fenceVdsManuallyParams , getContext ( ) ) ; }
Source:
public void setupMocks ( ) { org.mockito.Mockito.when ( clusterDao.get ( org.ovirt.engine.core.bll.gluster.RefreshGlusterHooksCommandTest.CLUSTER_ID ) ) . thenReturn ( getCluster ( ) ) ; org.mockito.Mockito.doReturn ( clusterDao ) . when ( cmd ) . getClusterDao ( ) ; org.mockito.Mockito.when ( cmd.getSyncJobInstance ( ) ) . thenReturn ( hookSyncJob ) ; }

Target:
public void validateFailsOnNullCluster ( ) { cmd.setClusterId ( null ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID.toString ( ) ) ) ; }
Source:
public static void GetRpmVersionViaPublic ( 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.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunPublicQuery ( VdcQueryType.GetConfigurationValue , new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.ProductRPMVersion , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public static void getGlusterHooks ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetGlusterHooks , new org.ovirt.engine.core.common.queries.gluster.GlusterParameters ( clusterId ) , aQuery ) ; }