auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void getStorageDomainById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storageDomainId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( storageDomainId ) , aQuery ) ; }

Target:
public void getVmDiskList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId , boolean isRefresh ) { 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 source ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.DiskImage > ( ) ; } } ; org.ovirt.engine.core.common.queries.IdQueryParameters params = new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) ; params.setRefresh ( isRefresh ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllDisksByVmId , params , aQuery ) ; }
Source:
public int compare ( org.ovirt.engine.api.model.Network n1 , org.ovirt.engine.api.model.Network n2 ) { if ( n1.getId ( ) . equals ( n2.getId ( ) ) ) { return 0 ; } else { return n1.getId ( ) . compareTo ( n2.getId ( ) ) ; } }

Target:
private java.util.List < org.ovirt.engine.api.model.Network > getNetworks ( ) { java.util.List < org.ovirt.engine.api.model.Network > entities = new java.util.ArrayList < > ( ) ; for ( int i = 0 ; i < ( NAMES.length ) ; i ++ ) { entities.add ( getEntity ( i ) ) ; } return entities ; }
Source:
public org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturnForXmlRpc glusterVolumeCreate ( java.lang.String volumeName , java.lang.String [ ] brickList , int replicaCount , int stripeCount , java.lang.String [ ] transportList ) { try { return new org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturnForXmlRpc ( vdsServer.glusterVolumeCreate ( volumeName , brickList , replicaCount , stripeCount , transportList ) ) ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc add_image_ticket ( java.lang.String ticketId , java.lang.String [ ] ops , long timeout , long size , java.lang.String url ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.add_image_ticket ( ticketId , ops , timeout , size , url ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
private boolean isTunnelMigrationUsed ( ) { if ( ! ( org.ovirt.engine.core.common.FeatureSupported.tunnelMigration ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getVdsGroupCompatibilityVersion ( ) ) ) ) { return false ; } return ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getTunnelMigration ( ) ) != null ? org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getTunnelMigration ( ) : org.ovirt.engine.core.bll.MigrateVmCommand.getVdsGroup ( ) . isTunnelMigration ( ) ; }

Target:
private boolean isTunnelMigrationUsed ( ) { if ( ! ( org.ovirt.engine.core.common.FeatureSupported.tunnelMigration ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getClusterCompatibilityVersion ( ) ) ) ) { return false ; } return ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getTunnelMigration ( ) ) != null ? org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getTunnelMigration ( ) : org.ovirt.engine.core.bll.MigrateVmCommand.getCluster ( ) . isTunnelMigration ( ) ; }
Source:
public void testGetAllIds ( ) { java.util.List < org.ovirt.engine.core.compat.Guid > result = dao.getAllIds ( FixturesTool.DATA_CENTER , StorageDomainStatus.Active ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.compat.Guid id : result ) { org.junit.Assert.assertTrue ( ( ! ( Guid.Empty.equals ( id ) ) ) ) ; } }

Target:
public void testGetAllIds ( ) { java.util.List < org.ovirt.engine.core.compat.Guid > result = dao.getAllIds ( FixturesTool.DATA_CENTER , StorageDomainStatus.Active ) ; org.junit.jupiter.api.Assertions.assertNotNull ( result ) ; org.junit.jupiter.api.Assertions.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.compat.Guid id : result ) { org.junit.jupiter.api.Assertions.assertTrue ( ( ! ( Guid.Empty.equals ( id ) ) ) ) ; } }
Source:
public void testChangeCdUsingQueryParameter ( ) throws java.lang.Exception { resource.setUriInfo ( setUpChangeCdUriQueryExpectations ( ) ) ; setUpGetEntityExpectations ( 1 , VMStatus.Up ) ; setUpActionExpectations ( VdcActionType.ChangeDisk , org.ovirt.engine.core.common.action.ChangeDiskCommandParameters.class , new java.lang.String [ ] { "CdImagePath" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.ISO_PATH } , true , true ) ; org.ovirt.engine.api.model.CdRom cdrom = resource.update ( getUpdate ( ) ) ; assertTrue ( cdrom.isSetFile ( ) ) ; }

Target:
public void testGetCurrentWithGarbledMatrixReturnsCurrent ( ) throws java.lang.Exception { setUriInfo ( setUpUriMatrixExpectations ( "faSLe" ) ) ; setUpEntityQueryExpectations ( 1 ) ; control.replay ( ) ; org.ovirt.engine.api.model.CdRom cdrom = resource.get ( ) ; verifyModelWithCurrentCd ( cdrom ) ; }
Source:
protected org.ovirt.engine.api.model.VM getEntity ( int index ) { return org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.setUpEntityExpectations ( control.createMock ( org.ovirt.engine.api.model.VM.class ) , control.createMock ( org.ovirt.engine.core.common.businessentities.VmStatistics.class ) , index ) ; }

Target:
private void setUpGetSoundcardExpectations ( int ... idxs ) throws java.lang.Exception { for ( int i = 0 ; i < ( idxs.length ) ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetSoundDevices , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ idxs [ i ] ] } , new java.util.ArrayList < > ( ) ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { host = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; host.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; host.setVdsGroupCompatibilityVersion ( Version.v3_5 ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { host = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; host.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; host.setVdsGroupCompatibilityVersion ( Version.v3_5 ) ; managementNetworkUtil = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.network.cluster.ManagementNetworkUtil.class ) ; bond = new org.ovirt.engine.core.common.businessentities.network.Bond ( ) ; bond.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; }
Source:
public void save ( org.ovirt.engine.core.common.businessentities.AuditLog event ) { getCallsHandler ( ) . executeModification ( "InsertAuditLog" , getSqlMapper ( event ) . addValue ( "log_type_name" , event.getlog_type_name ( ) ) ) ; }

Target:
private org.springframework.jdbc.core.namedparam.MapSqlParameterSource getExternalEventSqlMapper ( org.ovirt.engine.core.common.businessentities.AuditLog event ) { return getSqlMapper ( event ) . addValue ( "origin" , event.getOrigin ( ) ) . addValue ( "custom_event_id" , event.getCustomEventId ( ) ) . addValue ( "event_flood_in_sec" , event.getEventFloodInSec ( ) ) . addValue ( "custom_data" , event.getCustomData ( ) ) ; }
Source:
public void addMethod ( org.ovirt.api.metamodel.concepts.Method action ) { methods.add ( action ) ; }

Target:
public java.util.List < org.ovirt.api.metamodel.concepts.Method > getMethods ( ) { java.util.List < org.ovirt.api.metamodel.concepts.Method > result = new java.util.ArrayList ( methods ) ; if ( ( base ) != null ) { result.addAll ( base.getMethods ( ) ) ; } result.sort ( java.util.Comparator.comparing ( Method :: getName ) ) ; return result ; }
Source:
protected void UpdateActionAvailability ( ) { super . UpdateActionAvailability ( ) ; getConnectCommand ( ) . setIsExecutionAllowed ( ( ( ( ( ! ( getIsConnected ( ) ) ) && ( ( getEntity ( ) ) != null ) ) && ( ( getEntity ( ) . getDisplayType ( ) ) == ( org.ovirt.engine.core.common.businessentities.DisplayType.qxl ) ) ) && ( IsVmConnectReady ( ) ) ) ) ; }

Target:
protected void updateActionAvailability ( ) { super . updateActionAvailability ( ) ; getConnectCommand ( ) . setIsExecutionAllowed ( ( ( ( ( ! ( getIsConnected ( ) ) ) && ( ( getEntity ( ) ) != null ) ) && ( ( getEntity ( ) . getDisplayType ( ) ) == ( org.ovirt.engine.core.common.businessentities.DisplayType.qxl ) ) ) && ( isVmConnectReady ( ) ) ) ) ; }
Source:
private void createStorageDomain ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus status ) { org.ovirt.engine.core.common.businessentities.StorageDomain domain = new org.ovirt.engine.core.common.businessentities.StorageDomain ( ) ; domain.setStatus ( status ) ; domain.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( storageDomainDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( domain ) ; org.mockito.Mockito.when ( storageDomainDao.getForStoragePool ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( domain ) ; }

Target:
private void createStorageDomain ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus status ) { org.ovirt.engine.core.common.businessentities.StorageDomain domain = new org.ovirt.engine.core.common.businessentities.StorageDomain ( ) ; domain.setStatus ( status ) ; domain.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( storageDomainDao.get ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( domain ) ; org.mockito.Mockito.when ( storageDomainDao.getForStoragePool ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( domain ) ; }
Source:
public void getClusterList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source != null ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > list = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ) ( source ) ) ; java.util.Collections.sort ( list , new org.ovirt.engine.core.common.businessentities.comparators.NameableComparator ( ) ) ; return list ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVdsGroupsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }

Target:
public void getMaxNumOfCPUsPerSocket ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 1 ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxNumOfCpuPerSocket ) ; tempVar.setVersion ( version ) ; getConfigFromCache ( tempVar , aQuery ) ; }
Source:
public void executeCommand ( ) { cmd.setGlusterVolumeId ( volumeId1 ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_VOLUME_DETAILS_REFRESH , cmd.getAuditLogTypeValue ( ) ) ; org.mockito.Mockito.verify ( syncJob , org.mockito.Mockito.times ( 1 ) ) . refreshVolumeDetails ( org.mockito.Matchers.any ( ) , org.mockito.Matchers.any ( ) ) ; }

Target:
public void executeCommand ( ) { cmd.setGlusterVolumeId ( volumeId1 ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_VOLUME_DETAILS_REFRESH , cmd.getAuditLogTypeValue ( ) ) ; org.mockito.Mockito.verify ( syncJob , org.mockito.Mockito.times ( 1 ) ) . refreshVolumeDetails ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ; }
Source:
public void getFreeVfOneFreeVf ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > freeVfs = freeVfCommon ( 1 , 4 , 3 , 2 , 1 ) ; org.junit.Assert.assertEquals ( 1 , freeVfs.size ( ) ) ; org.junit.Assert.assertTrue ( freeVfs.contains ( networkDeviceHelper.getFreeVf ( nic , null ) ) ) ; }

Target:
public void getFreeVfNoVfs ( ) { freeVfCommon ( 0 , 0 , 0 , 0 , 0 , 0 ) ; org.junit.Assert.assertNull ( networkDeviceHelper.getFreeVf ( nic , null ) ) ; }
Source:
public java.util.concurrent.Future < java.util.Map < java.lang.String , java.lang.Object > > setupNetworks ( org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct networks , org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct bonds , org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct options ) { return vdsServer.futureSetupNetworks ( networks.getInnerMap ( ) , bonds.getInnerMap ( ) , options.getInnerMap ( ) ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.gluster.GlusterServicesReturnForXmlRpc glusterServiceManage ( org.ovirt.engine.core.compat.Guid serverId , java.lang.String [ ] serviceList , java.lang.String actionType , boolean failOnError ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterServicesManage ( serviceList , actionType , failOnError ) ; org.ovirt.engine.core.vdsbroker.gluster.GlusterServicesReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.gluster.GlusterServicesReturnForXmlRpc ( serverId , xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
protected void EndWithFailure ( ) { SetIsVmRunningStateless ( ) ; if ( _isVmRunningStateless ) { org.ovirt.engine.core.common.action.VdcReturnValueBase vdcReturnValue = org.ovirt.engine.core.bll.Backend.getInstance ( ) . endAction ( VdcActionType.CreateAllSnapshotsFromVm , org.ovirt.engine.core.bll.RunVmCommand.getParameters ( ) . getImagesParameters ( ) . get ( 0 ) , new org.ovirt.engine.core.bll.context.CommandContext ( org.ovirt.engine.core.bll.RunVmCommand.getCompensationContext ( ) ) ) ; setSucceeded ( vdcReturnValue.getSucceeded ( ) ) ; } else { super . EndWithFailure ( ) ; } }

Target:
protected void EndWithFailure ( ) { SetIsVmRunningStateless ( ) ; rollbackQuota ( ) ; if ( _isVmRunningStateless ) { org.ovirt.engine.core.common.action.VdcReturnValueBase vdcReturnValue = org.ovirt.engine.core.bll.RunVmCommand.getBackend ( ) . endAction ( VdcActionType.CreateAllSnapshotsFromVm , org.ovirt.engine.core.bll.RunVmCommand.getParameters ( ) . getImagesParameters ( ) . get ( 0 ) , new org.ovirt.engine.core.bll.context.CommandContext ( org.ovirt.engine.core.bll.RunVmCommand.getCompensationContext ( ) ) ) ; setSucceeded ( vdcReturnValue.getSucceeded ( ) ) ; } else { super . EndWithFailure ( ) ; } }
Source:
public static java.util.List < org.ovirt.engine.core.common.businessentities.VmDevice > getVirtioScsiControllers ( org.ovirt.engine.core.compat.Guid vmId , org.ovirt.engine.core.compat.Guid userID , boolean isFiltered ) { return org.ovirt.engine.core.bll.utils.VmDeviceUtils.dao.getVmDeviceByVmIdTypeAndDevice ( vmId , VmDeviceGeneralType.CONTROLLER , VmDeviceType.VIRTIOSCSI.getName ( ) , userID , isFiltered ) ; }

Target:
public static void addImportedDevices ( org.ovirt.engine.core.common.businessentities.VmBase vmBase , boolean isImportAsNewEntity ) { if ( isImportAsNewEntity ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.setNewIdInImportedCollections ( vmBase ) ; } java.util.List < org.ovirt.engine.core.common.businessentities.VmDevice > vmDevicesToAdd = new java.util.ArrayList < > ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VmDevice > vmDevicesToUpdate = new java.util.ArrayList < > ( ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.addImportedDiskDevices ( vmBase , vmDevicesToUpdate ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.addImportedInterfaces ( vmBase , vmDevicesToUpdate ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.addImportedOtherDevices ( vmBase , vmDevicesToAdd ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.dao.saveAll ( vmDevicesToAdd ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.dao.updateAll ( vmDevicesToUpdate ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.VDS > getAllForStoragePoolAndStatus ( org.ovirt.engine.core.compat.Guid storagePool , org.ovirt.engine.core.common.businessentities.VDSStatus status ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > vdsList = getCallsHandler ( ) . executeReadList ( "getVdsByStoragePoolIdWithStatus" , org.ovirt.engine.core.dao.VdsDaoImpl.VdsRowMapper.instance , getCustomMapSqlParameterSource ( ) . addValue ( "storage_pool_id" , storagePool ) . addValue ( "status" , ( status != null ? status.getValue ( ) : null ) ) ) ; return uniteAgents ( vdsList ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.VDS > getAllForStoragePoolAndStatuses ( org.ovirt.engine.core.compat.Guid storagePool , java.util.Set < org.ovirt.engine.core.common.businessentities.VDSStatus > statuses ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > vdsList = getCallsHandler ( ) . executeReadList ( "getVdsByStoragePoolIdWithStatuses" , org.ovirt.engine.core.dao.VdsDaoImpl.VdsRowMapper.instance , getCustomMapSqlParameterSource ( ) . addValue ( "storage_pool_id" , storagePool ) . addValue ( "statuses" , ( statuses != null ? org.apache.commons.lang.StringUtils.join ( org.ovirt.engine.core.common.utils.IdentifiableUtils.getValues ( statuses ) , "," ) : null ) ) ) ; return uniteAgents ( vdsList ) ; }
Source:
public void canDoActionPreallocatedSpaceCheckSucceeds ( ) { final int availableSize = 12 ; final int usedSize = 8 ; org.ovirt.engine.core.compat.Guid sdid = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; initializeCommand ( sdid , VolumeType.Preallocated ) ; mockVm ( ) ; mockStorageDomain ( sdid , availableSize , usedSize ) ; mockStoragePoolIsoMap ( ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }

Target:
private static org.ovirt.engine.core.bll.validator.StorageDomainValidator mockStorageDomainValidatorWithSpace ( ) { org.ovirt.engine.core.bll.validator.StorageDomainValidator storageDomainValidator = org.ovirt.engine.core.bll.AddDiskToVmCommandTest.mockStorageDomainValidator ( ) ; org.mockito.Mockito.when ( storageDomainValidator.hasSpaceForNewDisk ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.DiskImage.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; return storageDomainValidator ; }
Source:
private void doTestBadUpdate ( boolean valid , boolean success , java.lang.String detail ) { setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateTag , org.ovirt.engine.core.common.action.TagsOperationParameters.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , valid , success ) ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.getModel ( 0 , false ) ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }

Target:
private void doTestBadUpdate ( boolean valid , boolean success , java.lang.String detail ) { setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateTag , org.ovirt.engine.core.common.action.TagsOperationParameters.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , valid , success ) ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.getModel ( 0 , false ) ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }
Source:
protected boolean buildAndCheckDestStorageDomains ( ) { boolean retValue = true ; if ( diskInfoDestinationMap.isEmpty ( ) ) { retValue = fillDestMap ( ) ; } else { retValue = validateProvidedDestinations ( ) ; } if ( retValue && ( ( getImagesToCheckDestinationStorageDomains ( ) . size ( ) ) != ( diskInfoDestinationMap.size ( ) ) ) ) { log.error ( "Can not find any default active domain for one of the disks of template with id '{}'" , vmDisksSource.getId ( ) ) ; addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS ) ; retValue = false ; } return retValue && ( validateIsImagesOnDomains ( ) ) ; }

Target:
protected boolean buildAndCheckDestStorageDomains ( ) { boolean retValue = true ; if ( diskInfoDestinationMap.isEmpty ( ) ) { retValue = fillDestMap ( ) ; } else { retValue = validateProvidedDestinations ( ) ; } if ( retValue && ( ( getImagesToCheckDestinationStorageDomains ( ) . size ( ) ) != ( diskInfoDestinationMap.size ( ) ) ) ) { log.error ( "Can not find any default active domain for one of the disks of template with id '{}'" , vmDisksSource.getId ( ) ) ; addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS ) ; retValue = false ; } return retValue && ( validateIsImagesOnDomains ( ) ) ; }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( target ) ) ; @ java.lang.SuppressWarnings ( value = "unchecked" ) java.util.Collection < org.ovirt.engine.core.common.businessentities.VmWatchdog > watchdogs = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; for ( org.ovirt.engine.core.common.businessentities.VmWatchdog watchdog : watchdogs ) { model.getWatchdogAction ( ) . setSelectedItem ( watchdog.getAction ( ) ) ; model.getWatchdogModel ( ) . setSelectedItem ( watchdog.getModel ( ) ) ; } }

Target:
public void onSuccess ( java.lang.Object nothing , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = this . getModel ( ) ; @ java.lang.SuppressWarnings ( value = "unchecked" ) java.util.Collection < org.ovirt.engine.core.common.businessentities.VmWatchdog > watchdogs = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; for ( org.ovirt.engine.core.common.businessentities.VmWatchdog watchdog : watchdogs ) { model.getWatchdogAction ( ) . setSelectedItem ( watchdog.getAction ( ) ) ; model.getWatchdogModel ( ) . setSelectedItem ( watchdog.getModel ( ) ) ; } }
Source:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.Nic model = new org.ovirt.engine.api.model.Nic ( ) ; model.setName ( null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Nic" , "add" , "name" ) ; } }

Target:
public void testSubResourceLocatorBadGuid ( ) { verifyNotFoundException ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , ( ) -> org.ovirt.engine.api.restapi.resource.collection.getNicResource ( "foo" ) ) ) ; }
Source:
private void Cluster_SelectedItemChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { behavior.Cluster_SelectedItemChanged ( ) ; UpdateMaximalVmMemSize ( ) ; }

Target:
private void dataCenterWithClusterSelectedItemChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { behavior.dataCenterWithClusterSelectedItemChanged ( ) ; org.ovirt.engine.ui.uicommonweb.models.vms.DataCenterWithCluster dataCenterWithCluster = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DataCenterWithCluster ) ( getDataCenterWithClustersList ( ) . getSelectedItem ( ) ) ) ; if ( ( dataCenterWithCluster != null ) && ( ( dataCenterWithCluster.getDataCenter ( ) ) != null ) ) { getDisksAllocationModel ( ) . setQuotaEnforcementType ( dataCenterWithCluster.getDataCenter ( ) . getQuotaEnforcementType ( ) ) ; } updateMaximalVmMemSize ( ) ; }
Source:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( org.ovirt.engine.core.vdsbroker.irsbroker.ExtendStorageDomainVDSCommand.getReturnStatus ( ) ) ; switch ( returnStatus ) { case DeviceNotFound : org.ovirt.engine.core.vdsbroker.irsbroker.ExtendStorageDomainVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; break ; default : super . ProceedProxyReturnValue ( ) ; InitializeVdsError ( returnStatus ) ; break ; } }

Target:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( org.ovirt.engine.core.vdsbroker.irsbroker.ExtendStorageDomainVDSCommand.getReturnStatus ( ) ) ; switch ( returnStatus ) { case DeviceNotFound : org.ovirt.engine.core.vdsbroker.irsbroker.ExtendStorageDomainVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; break ; default : super . ProceedProxyReturnValue ( ) ; initializeVdsError ( returnStatus ) ; break ; } }
Source:
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 ) ; } }

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 ( ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }
Source:
public void init ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > disksImages ) { setDiskImages ( disksImages ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetDiskList ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.templates.CopyDiskModel copyDiskModel = ( ( org.ovirt.engine.ui.uicommonweb.models.templates.CopyDiskModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > disks = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( returnValue ) ) ; copyDiskModel.onInitAllDisks ( disks ) ; copyDiskModel.onInitDisks ( ) ; } } ) ) ; }

Target:
public void init ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > disksImages ) { setDiskImages ( disksImages ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDiskList ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.templates.CopyDiskModel copyDiskModel = ( ( org.ovirt.engine.ui.uicommonweb.models.templates.CopyDiskModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > disks = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( returnValue ) ) ; copyDiskModel.onInitAllDisks ( disks ) ; copyDiskModel.onInitDisks ( ) ; } } ) ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc startSpice ( java.lang.String vdsIp , int port , java.lang.String ticket ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.startSpice ( vdsIp , port , ticket ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc add_image_ticket ( java.lang.String ticketId , java.lang.String [ ] ops , long timeout , long size , java.lang.String url ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.add_image_ticket ( ticketId , ops , timeout , size , url ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
private boolean validateDomainsThreshold ( org.ovirt.engine.core.bll.validator.StorageDomainValidator storageDomainValidator ) { return validate ( storageDomainValidator.isDomainWithinThresholds ( ) ) ; }

Target:
protected boolean validateSpaceRequirements ( ) { for ( java.util.Map.Entry < org.ovirt.engine.core.compat.Guid , java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > > sdImageEntry : storageToDisksMap.entrySet ( ) ) { org.ovirt.engine.core.common.businessentities.StorageDomain destStorageDomain = destStorages.get ( sdImageEntry.getKey ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > disksList = sdImageEntry.getValue ( ) ; org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator storageDomainValidator = createStorageDomainValidator ( destStorageDomain ) ; if ( ( ! ( validateDomainsThreshold ( storageDomainValidator ) ) ) || ( ! ( validateFreeSpace ( storageDomainValidator , disksList ) ) ) ) { return false ; } } return true ; }
Source:
public void testSaveMemoryPciPassthroughFailure ( ) { cmd.getParameters ( ) . setSaveMemory ( true ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES ) ) . when ( vmValidator ) . vmNotHavingPciPassthroughDevices ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; org.junit.Assert.assertThat ( cmd.getReturnValue ( ) . getValidationMessages ( ) , org.hamcrest.Matchers.hasItem ( EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES.name ( ) ) ) ; }

Target:
public void testSaveMemoryPciPassthroughFailure ( ) { cmd.getParameters ( ) . setSaveMemory ( true ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES ) ) . when ( vmValidator ) . vmNotHavingPciPassthroughDevices ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES ) ; }
Source:
protected boolean canDoAction ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap > poolDomains = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStoragePoolIsoMapDao ( ) . getAllForStoragePool ( org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.getStoragePool ( ) . getId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap poolDomain : poolDomains ) { if ( ( poolDomain.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Locked ) ) { addInvalidSDStatusMessage ( poolDomain.getstatus ( ) ) ; return false ; } } return org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.InitializeVds ( ) ; }

Target:
protected boolean canDoAction ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap > poolDomains = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStoragePoolIsoMapDao ( ) . getAllForStoragePool ( org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.getStoragePool ( ) . getId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap poolDomain : poolDomains ) { if ( ( poolDomain.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Locked ) ) { addInvalidSDStatusMessage ( poolDomain.getstatus ( ) ) ; return false ; } } return org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.initializeVds ( ) ; }
Source:
private void updateShareableDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { boolean isShareableDiskEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.ShareableDiskEnabled , datacenter.getCompatibilityVersion ( ) . getValue ( ) ) ) ) ; getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.shareableDiskNotSupported ( ) ) ; getIsShareable ( ) . setIsChangable ( ( isShareableDiskEnabled && ( isEditEnabled ( ) ) ) ) ; }

Target:
private void updateShareableDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { boolean isShareableDiskEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.ShareableDiskEnabled , datacenter.getCompatibilityVersion ( ) . getValue ( ) ) ) ) ; getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.shareableDiskNotSupported ( ) ) ; getIsShareable ( ) . setIsChangeable ( ( isShareableDiskEnabled && ( isEditEnabled ( ) ) ) ) ; }
Source:
public void testGetCdInterface ( ) { org.junit.Assert.assertEquals ( "ide" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , null ) ) ; org.junit.Assert.assertEquals ( "ide" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , ChipsetType.I440FX ) ) ; org.junit.Assert.assertEquals ( "sata" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , ChipsetType.Q35 ) ) ; }

Target:
public void testGetCdInterface ( ) { org.junit.jupiter.api.Assertions.assertEquals ( "ide" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , null ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( "ide" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , ChipsetType.I440FX ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( "sata" , OsRepositoryImpl.INSTANCE.getCdInterface ( 777 , null , ChipsetType.Q35 ) ) ; }
Source:
private static org.ovirt.vdsm.jsonrpc.client.reactors.Reactor getNioReactor ( ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { if ( ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor ) != null ) { return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor ; } synchronized ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.class ) { if ( ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor ) != null ) { return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor ; } try { org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor = new org.ovirt.vdsm.jsonrpc.client.reactors.NioReactor ( ) ; } catch ( java.io.IOException e ) { throw new org.ovirt.vdsm.jsonrpc.client.ClientConnectionException ( e ) ; } } return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.nioReactor ; }

Target:
private static org.ovirt.vdsm.jsonrpc.client.reactors.Reactor getStompReactor ( org.ovirt.vdsm.jsonrpc.client.reactors.ManagerProvider provider ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { if ( provider != null ) { return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.getSslStompReactor ( provider ) ; } if ( ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor ) != null ) { return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor ; } synchronized ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.class ) { if ( ( org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor ) != null ) { return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor ; } try { org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor = new org.ovirt.vdsm.jsonrpc.client.reactors.stomp.StompReactor ( ) ; } catch ( java.io.IOException e ) { throw new org.ovirt.vdsm.jsonrpc.client.ClientConnectionException ( e ) ; } } return org.ovirt.vdsm.jsonrpc.client.reactors.ReactorFactory.stompReactor ; }
Source:
private int calculateValue ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster networkCluster ) { int res = 0 ; if ( networkCluster != null ) { if ( networkCluster.isDisplay ( ) ) { res += 2 ; } if ( networkCluster.isMigration ( ) ) { res += 1 ; } } return res ; }

Target:
private int calculateValue ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster networkCluster ) { int res = 0 ; if ( networkCluster != null ) { if ( networkCluster.isManagement ( ) ) { res += 10 ; } if ( networkCluster.isDisplay ( ) ) { res += 4 ; } if ( networkCluster.isMigration ( ) ) { res += 2 ; } if ( networkCluster.isGluster ( ) ) { res += 1 ; } } return res ; }
Source:
public void moveMacsOfUpdatedCluster ( org.ovirt.engine.core.compat.Guid oldMacPoolId , org.ovirt.engine.core.compat.Guid newMacPoolId , org.ovirt.engine.core.compat.Guid clusterId , org.ovirt.engine.core.bll.context.CommandContext commandContext ) { java.util.Objects.requireNonNull ( oldMacPoolId ) ; java.util.Objects.requireNonNull ( newMacPoolId ) ; if ( needToMigrateMacs ( oldMacPoolId , newMacPoolId ) ) { migrateMacs ( oldMacPoolId , newMacPoolId , clusterId , commandContext ) ; } }

Target:
public void moveMacsOfUpdatedCluster ( org.ovirt.engine.core.common.businessentities.Cluster sourceCluster , org.ovirt.engine.core.compat.Guid targetMacPoolId , org.ovirt.engine.core.bll.context.CommandContext commandContext ) { java.util.Objects.requireNonNull ( sourceCluster ) ; java.util.Objects.requireNonNull ( targetMacPoolId ) ; org.ovirt.engine.core.compat.Guid sourceMacPoolId = sourceCluster.getMacPoolId ( ) ; org.ovirt.engine.core.compat.Guid clusterId = sourceCluster.getId ( ) ; java.util.Objects.requireNonNull ( sourceMacPoolId ) ; java.util.Objects.requireNonNull ( clusterId ) ; if ( needToMigrateMacs ( sourceMacPoolId , targetMacPoolId ) ) { java.util.List < java.lang.String > macsToMigrate = vmNicDao.getAllMacsByClusterId ( clusterId ) ; migrateMacsToAnotherMacPool ( sourceMacPoolId , targetMacPoolId , macsToMigrate , commandContext ) ; } }
Source:
private void extractRemovedNetworks ( ) { for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface : getExistingIfaces ( ) . values ( ) ) { java.lang.String net = iface.getNetworkName ( ) ; if ( ( org.apache.commons.lang.StringUtils.isNotBlank ( net ) ) && ( ! ( attachedNetworksNames.contains ( net ) ) ) ) { removedNetworks.add ( net ) ; } } java.util.List < java.lang.String > vmNames = getVmInterfaceManager ( ) . findActiveVmsUsingNetworks ( params.getVdsId ( ) , removedNetworks ) ; for ( java.lang.String vmName : vmNames ) { addViolation ( VdcBllMessages.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS , vmName ) ; } }

Target:
private void validateGateway ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface ) { if ( ( ( org.apache.commons.lang.StringUtils.isNotEmpty ( iface.getGateway ( ) ) ) && ( ! ( managementNetworkUtil.isManagementNetwork ( iface.getNetworkName ( ) , vds.getVdsGroupId ( ) ) ) ) ) && ( ! ( org.ovirt.engine.core.common.FeatureSupported.multipleGatewaysSupported ( vds.getVdsGroupCompatibilityVersion ( ) ) ) ) ) { addViolation ( EngineMessage.NETWORK_ATTACH_ILLEGAL_GATEWAY , iface.getNetworkName ( ) ) ; } }
Source:
public void validateSucceedsOnStartedVolume ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters ( org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) , null ) ) ; prepareMocks ( cmd ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void prepareMocks ( ) { org.mockito.Mockito.doReturn ( volumeDao ) . when ( cmd ) . getGlusterVolumeDao ( ) ; org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( cmd ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StartGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ; }
Source:
protected void getDowntime ( ) { if ( org.ovirt.engine.core.common.FeatureSupported.migrateDowntime ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getVdsGroupCompatibilityVersion ( ) ) ) { try { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.MigrateStatus , new org.ovirt.engine.core.common.vdscommands.MigrateStatusVDSCommandParameters ( getDestinationVdsId ( ) , org.ovirt.engine.core.bll.MigrateVmCommand.getVmId ( ) ) ) ; if ( retVal != null ) { actualDowntime = ( ( java.lang.Integer ) ( retVal.getReturnValue ( ) ) ) ; } } catch ( org.ovirt.engine.core.common.errors.VdcBLLException e ) { migrationErrorCode = e.getErrorCode ( ) ; } } }

Target:
protected void getDowntime ( ) { if ( org.ovirt.engine.core.common.FeatureSupported.migrateDowntime ( org.ovirt.engine.core.bll.MigrateVmCommand.getVm ( ) . getVdsGroupCompatibilityVersion ( ) ) ) { try { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.MigrateStatus , new org.ovirt.engine.core.common.vdscommands.MigrateStatusVDSCommandParameters ( getDestinationVdsId ( ) , org.ovirt.engine.core.bll.MigrateVmCommand.getVmId ( ) ) ) ; if ( retVal != null ) { actualDowntime = ( ( java.lang.Integer ) ( retVal.getReturnValue ( ) ) ) ; } } catch ( org.ovirt.engine.core.common.errors.EngineException e ) { migrationErrorCode = e.getErrorCode ( ) ; } } }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = runVdsCommand ( VDSCommandType.StartGlusterVolume , new org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeActionVDSParameters ( getUpServer ( ) . getId ( ) , getGlusterVolumeName ( ) , getParameters ( ) . isForceAction ( ) ) ) ; setSucceeded ( returnValue.getSucceeded ( ) ) ; if ( getSucceeded ( ) ) { updateVolumeStatusInDb ( getParameters ( ) . getVolumeId ( ) ) ; } else { handleVdsError ( AuditLogType.GLUSTER_VOLUME_START_FAILED , returnValue.getVdsError ( ) . getMessage ( ) ) ; return ; } }

Target:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume = getGlusterVolume ( ) ; if ( volume.isOnline ( ) ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED ) ; addCanDoActionMessage ( java.lang.String.format ( "$volumeName %1$s" , volume.getName ( ) ) ) ; return false ; } return true ; }
Source:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigModel model ) { driver.edit ( model ) ; }

Target:
public void edit ( final org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigModel model ) { driver.edit ( model ) ; networks.asEditor ( ) . edit ( model.getNetworks ( ) ) ; initNetworksTable ( ) ; updateAllowedNetworksPanelVisibility ( model ) ; model.getAllNetworksAllowed ( ) . getSelectedItemChangedEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { updateAllowedNetworksPanelVisibility ( model ) ; } } ) ; }
Source:
public void stop ( ) { if ( ( _thread ) != null ) { try { _thread.join ( org.ovirt.engine.core.bll.hostdeploy.OVirtNodeUpgrade.THREAD_JOIN_TIMEOUT ) ; } catch ( java.lang.InterruptedException e ) { org.ovirt.engine.core.bll.hostdeploy.OVirtNodeUpgrade.log.error ( "interrupted" , e ) ; } if ( _thread.isAlive ( ) ) { _thread.interrupt ( ) ; while ( true ) { try { _thread.join ( ) ; break ; } catch ( java.lang.InterruptedException e ) { } } } _thread = null ; } }

Target:
public void stop ( ) { if ( ( _thread ) != null ) { try { _thread.join ( org.ovirt.engine.core.bll.hostdeploy.OVirtNodeUpgrade.THREAD_JOIN_TIMEOUT ) ; } catch ( java.lang.InterruptedException e ) { org.ovirt.engine.core.bll.hostdeploy.OVirtNodeUpgrade.log.error ( "interrupted" , e ) ; } if ( _thread.isAlive ( ) ) { _thread.interrupt ( ) ; while ( true ) { try { _thread.join ( ) ; break ; } catch ( java.lang.InterruptedException ignore ) { } } } _thread = null ; } }
Source:
protected org.ovirt.engine.core.compat.Guid getClusterId ( org.ovirt.engine.api.model.Action action ) { if ( action.getCluster ( ) . isSetId ( ) ) { return asGuid ( action.getCluster ( ) . getId ( ) ) ; } else { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = lookupClusterByName ( action.getCluster ( ) . getName ( ) ) ; return cluster != null ? cluster.getId ( ) : null ; } }

Target:
protected org.ovirt.engine.core.compat.Guid getClusterId ( org.ovirt.engine.api.model.Action action ) { if ( action.getCluster ( ) . isSetId ( ) ) { return asGuid ( action.getCluster ( ) . getId ( ) ) ; } else { org.ovirt.engine.core.common.businessentities.Cluster cluster = lookupClusterByName ( action.getCluster ( ) . getName ( ) ) ; return cluster != null ? cluster.getId ( ) : null ; } }