auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getReturnStatus ( ) ) ; switch ( returnStatus ) { case UnknownTask : org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.log.error ( java.lang.String.format ( "Trying to remove unknown task: %1$s" , org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getParameters ( ) . getTaskId ( ) ) ) ; return ; case TaskStateError : InitializeVdsError ( returnStatus ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; return ; } super . ProceedProxyReturnValue ( ) ; }

Target:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getReturnStatus ( ) ) ; switch ( returnStatus ) { case UnknownTask : log.error ( java.lang.String.format ( "Trying to remove unknown task: %1$s" , org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getParameters ( ) . getTaskId ( ) ) ) ; return ; case TaskStateError : InitializeVdsError ( returnStatus ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.HSMClearTaskVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; return ; } super . ProceedProxyReturnValue ( ) ; }
Source:
public java.util.concurrent.Future < org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse > call ( org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest req ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { final org.ovirt.vdsm.jsonrpc.client.internal.Call call = new org.ovirt.vdsm.jsonrpc.client.internal.Call ( req ) ; this . tracker.registerCall ( req , call ) ; try { this . getClient ( ) . sendMessage ( org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.jsonToByteArray ( req.toJson ( ) ) ) ; } finally { retryCall ( req , call ) ; } return call ; }

Target:
public java.util.concurrent.Future < org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse > call ( org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest req ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { final org.ovirt.vdsm.jsonrpc.client.internal.Call call = new org.ovirt.vdsm.jsonrpc.client.internal.Call ( req ) ; this . tracker.registerCall ( req , call ) ; retryCall ( req , call ) ; try { this . getClient ( ) . sendMessage ( org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.jsonToByteArray ( req.toJson ( ) ) ) ; } finally { retryCall ( req , call ) ; } return call ; }
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 < > ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection1 = newNFSConnection ; connections.add ( connection1 ) ; org.mockito.Mockito.when ( storageConnDao.getAllForStorage ( newNFSConnection.getConnection ( ) ) ) . thenReturn ( connections ) ; boolean isExists = command.isConnWithSameDetailsExists ( newNFSConnection , null ) ; org.junit.Assert.assertFalse ( isExists ) ; }

Target:
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 ) ; }
Source:
private org.ovirt.engine.core.common.action.VdcActionParametersBase setReinitializeSysPrep ( org.ovirt.engine.core.common.action.RunVmOnceParams params ) { org.ovirt.engine.api.model.VM vm = getEntity ( org.ovirt.engine.api.model.VM.class , VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.GetVmByVmIdParameters ( guid ) , "VM" ) ; if ( ( vm.getVmOs ( ) . isWindows ( ) ) && ( vm.isFirstRun ( ) ) ) { params.setReinitialize ( true ) ; } return params ; }

Target:
private org.ovirt.engine.core.common.action.VdcActionParametersBase setReinitializeSysPrep ( org.ovirt.engine.core.common.action.RunVmOnceParams params ) { org.ovirt.engine.api.model.VM vm = getEntity ( org.ovirt.engine.api.model.VM.class , VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( guid ) , "VM" ) ; if ( ( vm.getVmOs ( ) . isWindows ( ) ) && ( vm.isFirstRun ( ) ) ) { params.setReinitialize ( true ) ; } return params ; }
Source:
public void init ( java.util.List < org.ovirt.engine.core.common.businessentities.VM > externalVms , final org.ovirt.engine.core.compat.Guid dataCenterId ) { setCloseCommand ( new org.ovirt.engine.ui.uicommonweb.UICommand ( null , this ) . setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . close ( ) ) . setIsDefault ( true ) . setIsCancel ( true ) ) ; setTargetArchitecture ( externalVms.iterator ( ) . next ( ) . getClusterArch ( ) ) ; super . setItems ( new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { doInit ( dataCenterId ) ; } } , externalVms ) ; }

Target:
public void init ( java.util.List < org.ovirt.engine.core.common.businessentities.VM > externalVms , final org.ovirt.engine.core.compat.Guid dataCenterId ) { setCloseCommand ( new org.ovirt.engine.ui.uicommonweb.UICommand ( null , this ) . setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . close ( ) ) . setIsDefault ( true ) . setIsCancel ( true ) ) ; setTargetArchitecture ( externalVms ) ; super . setItems ( new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { doInit ( dataCenterId ) ; } } , externalVms ) ; }
Source:
protected void updateMoveOrCopySingleDiskParameters ( java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > parameters , org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel diskModel ) { org.ovirt.engine.core.common.businessentities.storage_domains selectedStorageDomain = ( ( org.ovirt.engine.core.common.businessentities.storage_domains ) ( diskModel.getStorageDomain ( ) . getSelectedItem ( ) ) ) ; addMoveOrCopyParameters ( parameters , Guid.Empty , selectedStorageDomain.getId ( ) , ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( diskModel.getDisk ( ) ) ) , ImageOperation.Move ) ; }

Target:
protected void updateMoveOrCopySingleDiskParameters ( java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > parameters , org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel diskModel ) { org.ovirt.engine.core.common.businessentities.storage_domains selectedStorageDomain = ( ( org.ovirt.engine.core.common.businessentities.storage_domains ) ( diskModel.getStorageDomain ( ) . getSelectedItem ( ) ) ) ; addMoveOrCopyParameters ( parameters , Guid.Empty , selectedStorageDomain.getId ( ) , ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( diskModel.getDisk ( ) ) ) ) ; }
Source:
protected boolean validateStpProperty ( ) { boolean stpIsAllowed = true ; if ( ( ! ( org.ovirt.engine.core.bll.network.dc.NetworkCommon.getParameters ( ) . getNetwork ( ) . isVmNetwork ( ) ) ) && ( org.ovirt.engine.core.bll.network.dc.NetworkCommon.getParameters ( ) . getNetwork ( ) . getstp ( ) ) ) { addCanDoActionMessage ( VdcBllMessages.NON_VM_NETWORK_CANNOT_SUPPORT_STP ) ; stpIsAllowed = false ; } return stpIsAllowed ; }

Target:
protected boolean validateStpProperty ( ) { boolean stpIsAllowed = true ; if ( ( ! ( getNetwork ( ) . isVmNetwork ( ) ) ) && ( getNetwork ( ) . getstp ( ) ) ) { addCanDoActionMessage ( VdcBllMessages.NON_VM_NETWORK_CANNOT_SUPPORT_STP ) ; stpIsAllowed = false ; } return stpIsAllowed ; }
Source:
public boolean pollVds ( ) { try { org.ovirt.engine.core.common.interfaces.FutureVDSCall < org.ovirt.engine.core.common.vdscommands.VDSReturnValue > task = org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . runFutureVdsCommand ( FutureVDSCommandType.Poll , new org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase ( host.getId ( ) ) ) ; org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = task.get ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.SetupNetworksPollingTimeout ) , java.util.concurrent.TimeUnit.SECONDS ) ; if ( returnValue.getSucceeded ( ) ) { return true ; } } catch ( java.lang.Exception e ) { } return false ; }

Target:
public boolean pollVds ( ) { try { org.ovirt.engine.core.common.interfaces.FutureVDSCall < org.ovirt.engine.core.common.vdscommands.VDSReturnValue > task = org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . runFutureVdsCommand ( FutureVDSCommandType.Poll , new org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase ( host.getId ( ) ) ) ; org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = task.get ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.SetupNetworksPollingTimeout ) , java.util.concurrent.TimeUnit.SECONDS ) ; if ( returnValue.getSucceeded ( ) ) { return true ; } } catch ( java.lang.Exception e ) { } return false ; }
Source:
private org.ovirt.engine.core.common.businessentities.VmDevice createMemoryDevice ( ) { java.util.Map < java.lang.String , java.lang.Object > specParams = new java.util.HashMap < > ( ) ; specParams.put ( org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.DEVICE_SIZE_FIELD_KEY , memoryToConsume ) ; specParams.put ( org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.DEVICE_NODE_FIELD_KEY , org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.getParameters ( ) . getNumaNode ( ) ) ; return new org.ovirt.engine.core.common.businessentities.VmDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.getVmId ( ) ) , org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType.MEMORY , VmDeviceType.MEMORY.getName ( ) , "" , 0 , specParams , true , true , false , "" , null , null , null ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.VmDevice createMemoryDevice ( ) { java.util.Map < java.lang.String , java.lang.Object > specParams = new java.util.HashMap < > ( ) ; specParams.put ( org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.DEVICE_SIZE_FIELD_KEY , memoryToConsume ) ; specParams.put ( org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.DEVICE_NODE_FIELD_KEY , org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.getParameters ( ) . getNumaNode ( ) ) ; return new org.ovirt.engine.core.common.businessentities.VmDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.bll.HotSetAmountOfMemoryCommand.getVmId ( ) ) , org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType.MEMORY , VmDeviceType.MEMORY.getName ( ) , "" , specParams , true , true , false , "" , null , null , null ) ; }
Source:
protected org.ovirt.engine.core.compat.Guid findImageForSameDrive ( org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType snapshotType ) { return findImageForSameDrive ( org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getSnapshotDao ( ) . getId ( org.ovirt.engine.core.bll.BaseImagesCommand.getVmDAO ( ) . getVmsListForDisk ( getImage ( ) . getId ( ) ) . get ( 0 ) . getId ( ) , snapshotType ) ) ; }

Target:
protected org.ovirt.engine.core.compat.Guid findImageForSameDrive ( org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType snapshotType ) { return findImageForSameDrive ( getSnapshotDao ( ) . getId ( org.ovirt.engine.core.bll.BaseImagesCommand.getVmDAO ( ) . getVmsListForDisk ( getImage ( ) . getId ( ) ) . get ( 0 ) . getId ( ) , snapshotType ) ) ; }
Source:
default void inputDetail ( ) { org.ovirt.api.metamodel.language.ApiLanguage.or ( org.ovirt.api.metamodel.language.ApiLanguage.mandatory ( cluster ( ) . id ( ) ) , org.ovirt.api.metamodel.language.ApiLanguage.mandatory ( cluster ( ) . name ( ) ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( clone ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( exclusive ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( template ( ) . name ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.or ( org.ovirt.api.metamodel.language.ApiLanguage.optional ( storageDomain ( ) . id ( ) ) , org.ovirt.api.metamodel.language.ApiLanguage.optional ( storageDomain ( ) . name ( ) ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( vm ( ) . diskAttachments ( ) [ org.ovirt.api.metamodel.language.ApiLanguage.COLLECTION ] . id ( ) ) ; }

Target:
default void inputDetail ( ) { org.ovirt.api.metamodel.language.ApiLanguage.or ( org.ovirt.api.metamodel.language.ApiLanguage.optional ( cluster ( ) . id ( ) ) , org.ovirt.api.metamodel.language.ApiLanguage.optional ( cluster ( ) . name ( ) ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( clone ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( exclusive ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( template ( ) . name ( ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.or ( org.ovirt.api.metamodel.language.ApiLanguage.optional ( storageDomain ( ) . id ( ) ) , org.ovirt.api.metamodel.language.ApiLanguage.optional ( storageDomain ( ) . name ( ) ) ) ; org.ovirt.api.metamodel.language.ApiLanguage.optional ( vm ( ) . diskAttachments ( ) [ org.ovirt.api.metamodel.language.ApiLanguage.COLLECTION ] . id ( ) ) ; }
Source:
public void postDataCenterWithClusterSelectedItemChanged ( ) { updateDefaultHost ( ) ; updateCustomPropertySheet ( ) ; updateMinAllocatedMemory ( ) ; updateNumOfSockets ( ) ; updateOSValues ( ) ; if ( ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) != null ) { org.ovirt.engine.core.common.businessentities.VmTemplate template = getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ; updateQuotaByCluster ( template.getQuotaId ( ) , template.getQuotaName ( ) ) ; } updateMemoryBalloon ( ) ; updateCpuSharesAvailability ( ) ; updateVirtioScsiAvailability ( ) ; updateTemplate ( ) ; }

Target:
public void postDataCenterWithClusterSelectedItemChanged ( ) { updateDefaultHost ( ) ; updateCustomPropertySheet ( ) ; updateMinAllocatedMemory ( ) ; updateNumOfSockets ( ) ; updateOSValues ( ) ; if ( ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) != null ) { org.ovirt.engine.core.common.businessentities.VmTemplate template = getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ; updateQuotaByCluster ( template.getQuotaId ( ) , template.getQuotaName ( ) ) ; } updateMemoryBalloon ( ) ; updateCpuSharesAvailability ( ) ; updateVirtioScsiAvailability ( ) ; }
Source:
public java.util.List < org.ovirt.engine.core.bll.utils.PermissionSubject > getPermissionCheckSubjects ( ) { org.ovirt.engine.core.common.businessentities.Network network = org.ovirt.engine.core.bll.network.dc.NetworkCommon.getParameters ( ) . getNetwork ( ) ; org.ovirt.engine.core.compat.Guid networkId = ( network == null ) ? null : network.getId ( ) ; return java.util.Collections.singletonList ( new org.ovirt.engine.core.bll.utils.PermissionSubject ( networkId , org.ovirt.engine.core.common.VdcObjectType.Network , org.ovirt.engine.core.bll.network.dc.NetworkCommon.getActionType ( ) . getActionGroup ( ) ) ) ; }

Target:
public java.util.List < org.ovirt.engine.core.bll.utils.PermissionSubject > getPermissionCheckSubjects ( ) { org.ovirt.engine.core.common.businessentities.Network network = getNetwork ( ) ; org.ovirt.engine.core.compat.Guid networkId = ( network == null ) ? null : network.getId ( ) ; return java.util.Collections.singletonList ( new org.ovirt.engine.core.bll.utils.PermissionSubject ( networkId , org.ovirt.engine.core.common.VdcObjectType.Network , org.ovirt.engine.core.bll.network.dc.NetworkCommon.getActionType ( ) . getActionGroup ( ) ) ) ; }
Source:
public void validRunningVmsOrVmLeasesForBackupDomain ( ) { org.mockito.Mockito.when ( vmDao.getAllActiveForStorageDomain ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( java.util.Collections.EMPTY_LIST ) ; org.ovirt.engine.core.common.queries.QueryReturnValue ret = new org.ovirt.engine.core.common.queries.QueryReturnValue ( ) ; ret.setReturnValue ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmBase > ( ) ) ; ret.setSucceeded ( true ) ; org.mockito.Mockito.doReturn ( ret ) . when ( validator ) . getEntitiesWithLeaseIdForStorageDomain ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.Assert.assertThat ( validator.isRunningVmsOrVmLeasesForBackupDomain ( vmHandler ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void validRunningVmsOrVmLeasesForBackupDomain ( ) { org.ovirt.engine.core.common.queries.QueryReturnValue ret = new org.ovirt.engine.core.common.queries.QueryReturnValue ( ) ; ret.setReturnValue ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmBase > ( ) ) ; ret.setSucceeded ( true ) ; org.mockito.Mockito.doReturn ( ret ) . when ( validator ) . getEntitiesWithLeaseIdForStorageDomain ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.Assert.assertThat ( validator.isRunningVmsOrVmLeasesForBackupDomain ( vmHandler ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
protected void setSuperItems ( java.lang.Iterable value ) { super . setItems ( value ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VM > list = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.VM > ) ( getItems ( ) ) ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : list ) { getDiskStorageMap ( ) . put ( vm.getId ( ) , new java.util.HashMap < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.compat.Guid > ( ) ) ; } initStorageDomains ( ) ; }

Target:
protected void setSuperItems ( java.lang.Iterable value ) { super . setItems ( value ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VM > list = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.VM > ) ( getItems ( ) ) ) ; }
Source:
private void assertGetDiscardAfterDeleteLegalForNewBlockStorageDomainPredicate ( boolean allLunsSupportDiscard ) { org.ovirt.engine.core.bll.validator.storage.StorageDomainValidatorTest.injectorRule.bind ( org.ovirt.engine.core.bll.storage.utils.BlockStorageDiscardFunctionalityHelper.class , discardFunctionalityHelper ) ; org.mockito.Mockito.when ( discardFunctionalityHelper.allLunsSupportDiscard ( org.mockito.ArgumentMatchers.anyCollection ( ) ) ) . thenReturn ( allLunsSupportDiscard ) ; org.junit.Assert.assertEquals ( validator.getDiscardAfterDeleteLegalForNewBlockStorageDomainPredicate ( java.util.Collections.emptyList ( ) ) . get ( ) , allLunsSupportDiscard ) ; }

Target:
private void assertGetDiscardAfterDeleteLegalForNewBlockStorageDomainPredicate ( boolean allLunsSupportDiscard ) { org.ovirt.engine.core.bll.validator.storage.StorageDomainValidatorTest.injectorRule.bind ( org.ovirt.engine.core.bll.storage.utils.BlockStorageDiscardFunctionalityHelper.class , discardFunctionalityHelper ) ; org.mockito.Mockito.when ( discardFunctionalityHelper.allLunsSupportDiscard ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( allLunsSupportDiscard ) ; org.junit.Assert.assertEquals ( validator.getDiscardAfterDeleteLegalForNewBlockStorageDomainPredicate ( java.util.Collections.emptyList ( ) ) . get ( ) , allLunsSupportDiscard ) ; }
Source:
protected void ExecuteVdsBrokerCommand ( ) { _result = org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getBroker ( ) . getStorageDomainStats ( org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getParameters ( ) . getStorageDomainId ( ) . toString ( ) ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.ProceedProxyReturnValue ( ) ; org.ovirt.engine.core.common.businessentities.storage_domains domain = org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.BuildStorageDynamicFromXmlRpcStruct ( _result.mStorageStats ) ; domain.setId ( org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getParameters ( ) . getStorageDomainId ( ) ) ; setReturnValue ( domain ) ; }

Target:
protected void ExecuteVdsBrokerCommand ( ) { _result = org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getBroker ( ) . getStorageDomainStats ( org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getParameters ( ) . getStorageDomainId ( ) . toString ( ) ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.ProceedProxyReturnValue ( ) ; org.ovirt.engine.core.common.businessentities.StorageDomain domain = org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.BuildStorageDynamicFromXmlRpcStruct ( _result.mStorageStats ) ; domain.setId ( org.ovirt.engine.core.vdsbroker.vdsbroker.GetStorageDomainStatsVDSCommand.getParameters ( ) . getStorageDomainId ( ) ) ; setReturnValue ( domain ) ; }
Source:
public void onSuccess ( java.lang.Object result ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > hosts = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > ) ( result ) ) ; org.ovirt.engine.ui.uicommonweb.models.ListModel < org.ovirt.engine.core.common.businessentities.VDS > hostNameListModel = getExternalHostName ( ) ; hostNameListModel.setItems ( hosts ) ; hostNameListModel.setIsChangeable ( true ) ; setEnableSearchHost ( true ) ; getProviders ( ) . setIsChangeable ( true ) ; }

Target:
public void onSuccess ( java.util.List < org.ovirt.engine.core.common.businessentities.VDS > hosts ) { org.ovirt.engine.ui.uicommonweb.models.ListModel < org.ovirt.engine.core.common.businessentities.VDS > hostNameListModel = getExternalHostName ( ) ; hostNameListModel.setItems ( hosts ) ; hostNameListModel.setIsChangeable ( true ) ; setEnableSearchHost ( true ) ; getProviders ( ) . setIsChangeable ( true ) ; }
Source:
public void refreshLightWeightData ( ) { org.ovirt.engine.core.bll.gluster.GlusterManager.log.debug ( "Refreshing Gluster Data [lightweight]" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > clusters = getClusterDao ( ) . getAll ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : clusters ) { if ( cluster.supportsGlusterService ( ) ) { try { refreshClusterData ( cluster ) ; } catch ( java.lang.Exception e ) { org.ovirt.engine.core.bll.gluster.GlusterManager.log.errorFormat ( "Error while refreshing Gluster lightweight data of cluster {0}!" , cluster.getname ( ) , e ) ; continue ; } } } }

Target:
public void refreshLightWeightData ( ) { org.ovirt.engine.core.bll.gluster.GlusterManager.log.debug ( "Refreshing Gluster Data [lightweight]" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > clusters = getClusterDao ( ) . getAll ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : clusters ) { if ( cluster.supportsGlusterService ( ) ) { try { refreshClusterData ( cluster ) ; } catch ( java.lang.Exception e ) { org.ovirt.engine.core.bll.gluster.GlusterManager.log.errorFormat ( "Error while refreshing Gluster lightweight data of cluster {0}!" , cluster.getname ( ) , e ) ; } } } }
Source:
public void commandFailsSlaveNotOvirtMonitored ( ) { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.SetupGlusterGeoRepMountBrokerInternalCommand ( new org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , new java.util.HashSet ( java.util.Collections.singletonList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ) , null , null ) ) ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( null ) . when ( command ) . getSlaveVolume ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }

Target:
public void commandFailsSlaveNotOvirtMonitored ( ) { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.SetupGlusterGeoRepMountBrokerInternalCommand ( new org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , new java.util.HashSet ( java.util.Collections.singletonList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ) , null , null ) , null ) ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( null ) . when ( command ) . getSlaveVolume ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }
Source:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { if ( ! ( org.ovirt.engine.core.bll.ApproveVdsCommand.getSucceeded ( ) ) ) { if ( ( _failureLogTypeValue ) == ( org.ovirt.engine.core.common.AuditLogType.VDS_INSTALL_FAILED ) ) { AddCustomValue ( "FailedInstallMessage" , getErrorMessage ( _failureMessage ) ) ; } return _failureLogTypeValue ; } else { return org.ovirt.engine.core.common.AuditLogType.VDS_APPROVE ; } }

Target:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { if ( org.ovirt.engine.core.bll.ApproveVdsCommand.getSucceeded ( ) ) { return org.ovirt.engine.core.common.AuditLogType.VDS_APPROVE ; } else { return super . getAuditLogTypeValue ( ) ; } }
Source:
private void setUpStorageHelper ( ) { org.ovirt.engine.core.bll.storage.connection.IStorageHelper helper = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.storage.connection.IStorageHelper.class ) ; org.mockito.Mockito.when ( helper.connectStorageToDomainByVdsIdDetails ( storageDomain , command.getParameters ( ) . getVdsId ( ) ) ) . thenReturn ( new org.ovirt.engine.core.common.utils.Pair < java.lang.Boolean , org.ovirt.engine.core.common.errors.EngineFault > ( true , null ) ) ; org.mockito.Mockito.when ( helper.disconnectStorageFromDomainByVdsId ( storageDomain , command.getParameters ( ) . getVdsId ( ) ) ) . thenReturn ( true ) ; org.mockito.Mockito.doReturn ( helper ) . when ( command ) . getStorageHelper ( storageDomain ) ; }

Target:
private void setUpStorageHelper ( ) { org.ovirt.engine.core.bll.storage.connection.IStorageHelper helper = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.storage.connection.IStorageHelper.class ) ; org.mockito.Mockito.when ( helper.connectStorageToDomainByVdsIdDetails ( storageDomain , command.getParameters ( ) . getVdsId ( ) ) ) . thenReturn ( new org.ovirt.engine.core.common.utils.Pair ( true , null ) ) ; org.mockito.Mockito.when ( helper.disconnectStorageFromDomainByVdsId ( storageDomain , command.getParameters ( ) . getVdsId ( ) ) ) . thenReturn ( true ) ; org.mockito.Mockito.doReturn ( helper ) . when ( command ) . getStorageHelper ( storageDomain ) ; }
Source:
public void calculateFreeSchedulingMemoryCache ( ) { if ( ( ( ( getMemCommited ( ) ) != null ) && ( ( getPhysicalMemMb ( ) ) != null ) ) && ( ( getReservedMem ( ) ) != null ) ) { maxSchedulingMemory = ( getFreeVirtualMemory ( ) ) - ( getPendingVmemSize ( ) ) ; maxSchedulingMemory = ( ( maxSchedulingMemory ) > 0 ) ? maxSchedulingMemory : 0 ; } }

Target:
private void calculateFreeSchedulingMemoryCache ( ) { if ( ( ( ( getMemCommited ( ) ) != null ) && ( ( getPhysicalMemMb ( ) ) != null ) ) && ( ( getReservedMem ( ) ) != null ) ) { maxSchedulingMemory = ( getFreeVirtualMemory ( ) ) - ( getPendingVmemSize ( ) ) ; maxSchedulingMemory = ( ( maxSchedulingMemory ) > 0 ) ? maxSchedulingMemory : 0 ; } }
Source:
private boolean isExternalNetworkProviderReadOnly ( org.ovirt.engine.core.common.businessentities.Provider provider ) { if ( ( provider.getType ( ) ) == ( org.ovirt.engine.core.common.businessentities.ProviderType.EXTERNAL_NETWORK ) ) { org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; if ( properties.getReadOnly ( ) ) { return true ; } } return false ; }

Target:
private boolean isExternalNetworkProviderReadOnly ( org.ovirt.engine.core.common.businessentities.Provider provider ) { org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; if ( properties.getReadOnly ( ) ) { return true ; } return false ; }
Source:
public static void GetDefaultSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; aQuery.asyncCallback.OnSuccess ( aQuery.getModel ( ) , 5 ) ; }

Target:
public static void GetDefaultSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getAdGroupDao ( ) ) ; newAdGroup = new org.ovirt.engine.core.common.businessentities.LdapGroup ( ) ; newAdGroup.setid ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; newAdGroup.setdomain ( "domain" ) ; newAdGroup.setname ( "name" ) ; newAdGroup.setstatus ( LdapRefStatus.Active ) ; existingAdGroup = dao.get ( new org.ovirt.engine.core.compat.Guid ( "b399944a-81ab-4ec5-8266-e19ba7c3c9d1" ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getAdGroupDao ( ) ; newAdGroup = new org.ovirt.engine.core.common.businessentities.LdapGroup ( ) ; newAdGroup.setid ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; newAdGroup.setdomain ( "domain" ) ; newAdGroup.setname ( "name" ) ; newAdGroup.setstatus ( LdapRefStatus.Active ) ; existingAdGroup = dao.get ( new org.ovirt.engine.core.compat.Guid ( "b399944a-81ab-4ec5-8266-e19ba7c3c9d1" ) ) ; }
Source:
private java.lang.Object getSnapshotVDSReturnVal ( boolean ret ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsRetValue = new org.ovirt.engine.core.common.vdscommands.VDSReturnValue ( ) ; vdsRetValue.setSucceeded ( ret ) ; if ( ret ) { vdsRetValue.setReturnValue ( getSnapshotDetails ( ) ) ; } else { vdsRetValue.setReturnValue ( null ) ; } return vdsRetValue ; }

Target:
private java.lang.Object getSnapshotVDSReturnVal ( ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsRetValue = new org.ovirt.engine.core.common.vdscommands.VDSReturnValue ( ) ; vdsRetValue.setSucceeded ( true ) ; vdsRetValue.setReturnValue ( getSnapshotDetails ( ) ) ; return vdsRetValue ; }
Source:
private boolean isLimitExceeded ( com.woorea.openstack.cinder.model.Limits limits , org.ovirt.engine.core.common.businessentities.storage.VolumeClassification cinderType , int diskCount ) { if ( cinderType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Snapshot ) ) { return ( ( limits.getAbsolute ( ) . getTotalSnapshotsUsed ( ) ) + diskCount ) >= ( limits.getAbsolute ( ) . getMaxTotalSnapshots ( ) ) ; } if ( cinderType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Volume ) ) { return ( ( limits.getAbsolute ( ) . getTotalVolumesUsed ( ) ) + diskCount ) >= ( limits.getAbsolute ( ) . getMaxTotalVolumes ( ) ) ; } return false ; }

Target:
private boolean isLimitExceeded ( com.woorea.openstack.cinder.model.Limits limits , org.ovirt.engine.core.common.businessentities.storage.VolumeClassification cinderType , int diskCount ) { if ( cinderType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Snapshot ) ) { return ( ( limits.getAbsolute ( ) . getTotalSnapshotsUsed ( ) ) + diskCount ) > ( limits.getAbsolute ( ) . getMaxTotalSnapshots ( ) ) ; } if ( cinderType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Volume ) ) { return ( ( limits.getAbsolute ( ) . getTotalVolumesUsed ( ) ) + diskCount ) > ( limits.getAbsolute ( ) . getMaxTotalVolumes ( ) ) ; } return false ; }
Source:
private void setDataCenterDetails ( ) { org.ovirt.engine.core.common.businessentities.StoragePool dc = org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getParameters ( ) . getStoragePool ( ) ; setCompatibilityVersion ( dc.getcompatibility_version ( ) . toString ( ) ) ; setStoragePoolType ( dc.getStorageType ( ) . name ( ) ) ; setQuotaEnforcementType ( dc.getQuotaEnforcementType ( ) . name ( ) ) ; }

Target:
private void setDataCenterDetails ( ) { org.ovirt.engine.core.common.businessentities.StoragePool dc = org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getParameters ( ) . getStoragePool ( ) ; setCompatibilityVersion ( dc.getcompatibility_version ( ) . toString ( ) ) ; setQuotaEnforcementType ( dc.getQuotaEnforcementType ( ) . name ( ) ) ; }
Source:
public void moveDisk ( ) { command.getParameters ( ) . setParametersList ( createMoveDisksParameters ( ) ) ; initDiskImage ( diskImageId ) ; initVm ( VMStatus.Down , null , diskImageId ) ; command.updateParameters ( ) ; org.junit.Assert.assertTrue ( ( ( command.getMoveDiskParametersList ( ) . size ( ) ) == 1 ) ) ; }

Target:
public void moveDisk ( ) { command.getParameters ( ) . setParametersList ( createMoveDisksParameters ( ) ) ; initDiskImage ( diskImageId ) ; initVm ( VMStatus.Down , null , diskImageId ) ; command.updateParameters ( ) ; org.junit.Assert.assertEquals ( 1 , command.getMoveDiskParametersList ( ) . size ( ) ) ; }
Source:
private static void addCommandForExistingQuota ( org.ovirt.engine.core.compat.Guid commandId , org.ovirt.engine.core.compat.Guid quotaLimitId , java.lang.Double desiredStorageSize , java.lang.Integer desiredCPUSize , java.lang.Double desiredMemSize , java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue > commandMap ) { org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue quotaStorageDeltaValue = new org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue ( desiredStorageSize , desiredCPUSize , desiredMemSize ) ; commandMap.put ( commandId , quotaStorageDeltaValue ) ; }

Target:
private static void addCommandForExistingQuota ( org.ovirt.engine.core.compat.Guid commandId , java.lang.Double desiredStorageSize , java.lang.Integer desiredCPUSize , java.lang.Double desiredMemSize , java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue > commandMap ) { org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue quotaStorageDeltaValue = new org.ovirt.engine.core.bll.QuotaManager.QuotaDeltaValue ( desiredStorageSize , desiredCPUSize , desiredMemSize ) ; commandMap.put ( commandId , quotaStorageDeltaValue ) ; }
Source:
private void updateActionAvailability ( ) { if ( ( ( getEntity ( ) ) == null ) || ( ( getEntity ( ) . isGroup ( ) ) == true ) ) { getManageEventsCommand ( ) . setIsExecutionAllowed ( false ) ; } else { getManageEventsCommand ( ) . setIsExecutionAllowed ( true ) ; } }

Target:
private void updateActionAvailability ( ) { if ( ( ( getEntity ( ) ) == null ) || ( getEntity ( ) . isGroup ( ) ) ) { getManageEventsCommand ( ) . setIsExecutionAllowed ( false ) ; } else { getManageEventsCommand ( ) . setIsExecutionAllowed ( true ) ; } }
Source:
public static java.util.List < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > getBlockDataStorageModels ( ) { java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > models = new java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > ( ) ; org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel iscsiDataModel = new org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel ( ) ; iscsiDataModel.setIsGrouppedByTarget ( true ) ; models.add ( iscsiDataModel ) ; org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel fcpDataModel = new org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel ( ) ; models.add ( fcpDataModel ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.addTypeToStorageModels ( StorageDomainType.Data , models ) ; return models ; }

Target:
public java.util.List < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > getBlockDataStorageModels ( ) { java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > models = new java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel > ( ) ; org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel iscsiDataModel = new org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel ( ) ; iscsiDataModel.setIsGrouppedByTarget ( true ) ; models.add ( iscsiDataModel ) ; org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel fcpDataModel = new org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel ( ) ; models.add ( fcpDataModel ) ; addTypeToStorageModels ( StorageDomainType.Data , models ) ; return models ; }
Source:
public void render ( com.google.gwt.cell.client.Cell.Context context , T object , com.google.gwt.safehtml.shared.SafeHtmlBuilder sb ) { if ( showMask.showMask ( object ) ) { sb.appendHtmlConstant ( "<div style=\"position: absolute; left: 19px\" >" ) ; com.google.gwt.safehtml.shared.SafeHtmlUtils.fromTrustedString ( com.google.gwt.user.client.ui.AbstractImagePrototype.create ( mask ) . getHTML ( ) ) ; sb.appendHtmlConstant ( "</div>" ) ; } super . render ( context , object , sb ) ; }

Target:
public void render ( com.google.gwt.cell.client.Cell.Context context , T object , com.google.gwt.safehtml.shared.SafeHtmlBuilder sb ) { if ( showMask.showMask ( object ) ) { sb.appendHtmlConstant ( "<div style=\"position: absolute; left: 19px\" >" ) ; sb.append ( com.google.gwt.safehtml.shared.SafeHtmlUtils.fromTrustedString ( com.google.gwt.user.client.ui.AbstractImagePrototype.create ( mask ) . getHTML ( ) ) ) ; sb.appendHtmlConstant ( "</div>" ) ; } super . render ( context , object , sb ) ; }
Source:
private void testValidSql ( java.lang.String dynamicQuery , java.lang.String exepctedSQLResult ) { org.ovirt.engine.core.searchbackend.SyntaxChecker chkr = new org.ovirt.engine.core.searchbackend.SyntaxChecker ( 20 ) ; org.ovirt.engine.core.searchbackend.ISyntaxChecker curSyntaxChecker = org.ovirt.engine.core.searchbackend.SyntaxCheckerFactory.createBackendSyntaxChecker ( "foo" ) ; org.ovirt.engine.core.searchbackend.SyntaxContainer res = curSyntaxChecker.analyzeSyntaxState ( dynamicQuery , true ) ; org.junit.Assert.assertTrue ( ( "Invalid syntax: " + dynamicQuery ) , res.getvalid ( ) ) ; java.lang.String query = chkr.generateQueryFromSyntaxContainer ( res , true ) ; java.lang.System.out.println ( exepctedSQLResult ) ; java.lang.System.out.println ( query ) ; org.junit.Assert.assertEquals ( exepctedSQLResult , query ) ; }

Target:
private void testValidSql ( java.lang.String dynamicQuery , java.lang.String exepctedSQLResult ) { org.ovirt.engine.core.searchbackend.SyntaxChecker chkr = new org.ovirt.engine.core.searchbackend.SyntaxChecker ( 20 ) ; org.ovirt.engine.core.searchbackend.ISyntaxChecker curSyntaxChecker = org.ovirt.engine.core.searchbackend.SyntaxCheckerFactory.createBackendSyntaxChecker ( "foo" ) ; org.ovirt.engine.core.searchbackend.SyntaxContainer res = curSyntaxChecker.analyzeSyntaxState ( dynamicQuery , true ) ; org.junit.Assert.assertTrue ( ( "Invalid syntax: " + dynamicQuery ) , res.getvalid ( ) ) ; java.lang.String query = chkr.generateQueryFromSyntaxContainer ( res , true ) ; org.junit.Assert.assertEquals ( exepctedSQLResult , query ) ; }
Source:
public void enableHaReservationCheck ( ) { if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.EnableVdsLoadBalancing ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Start HA Reservation check" ) ; java.lang.Integer interval = org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsHaReservationIntervalInMinutes ) ; org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl.class ) . scheduleAFixedDelayJob ( this , "performHaResevationCheck" , new java.lang.Class [ ] { } , new java.lang.Object [ ] { } , interval , interval , java.util.concurrent.TimeUnit.MINUTES ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Finished HA Reservation check" ) ; } }

Target:
private void enableHaReservationCheck ( ) { if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.EnableVdsLoadBalancing ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Start HA Reservation check" ) ; java.lang.Integer interval = org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsHaReservationIntervalInMinutes ) ; org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl.class ) . scheduleAFixedDelayJob ( this , "performHaResevationCheck" , new java.lang.Class [ ] { } , new java.lang.Object [ ] { } , interval , interval , java.util.concurrent.TimeUnit.MINUTES ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Finished HA Reservation check" ) ; } }
Source:
public static org.ovirt.engine.core.aaa.DirectoryUser findDirectoryUserById ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final java.lang.String namespace , final java.lang.String id , final boolean groupsResolving , final boolean groupsResolvingRecursive ) { java.util.Collection < org.ovirt.engine.core.aaa.DirectoryUser > users = org.ovirt.engine.core.bll.aaa.DirectoryUtils.findDirectoryUserByIds ( extension , namespace , java.util.Arrays.asList ( id ) , groupsResolving , groupsResolvingRecursive ) ; if ( ( users.size ( ) ) == 0 ) { return null ; } return new java.util.ArrayList < org.ovirt.engine.core.aaa.DirectoryUser > ( users ) . get ( 0 ) ; }

Target:
public static org.ovirt.engine.core.aaa.DirectoryUser findDirectoryUserById ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final java.lang.String namespace , final java.lang.String id , final boolean groupsResolving , final boolean groupsResolvingRecursive ) { java.util.Collection < org.ovirt.engine.core.aaa.DirectoryUser > users = org.ovirt.engine.core.bll.aaa.DirectoryUtils.findDirectoryUserByIds ( extension , namespace , java.util.Arrays.asList ( id ) , groupsResolving , groupsResolvingRecursive ) ; if ( ( users.size ( ) ) == 0 ) { return null ; } return new java.util.ArrayList ( users ) . get ( 0 ) ; }
Source:
public void testUpdateSetAndUploadIconFailure ( ) throws java.lang.Exception { control.replay ( ) ; final org.ovirt.engine.api.model.Template model = getRestModel ( 0 ) ; model.setSmallIcon ( org.ovirt.engine.api.restapi.resource.IconTestHelpler.createIcon ( GUIDS [ 2 ] ) ) ; model.setLargeIcon ( org.ovirt.engine.api.restapi.resource.IconTestHelpler.createIconWithData ( ) ) ; try { verifyModel ( resource.update ( model ) , 0 ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BAD_REQUEST ) ; } }

Target:
public void testUpdateSetAndUploadIconFailure ( ) throws java.lang.Exception { final org.ovirt.engine.api.model.Template model = getRestModel ( 0 ) ; model.setSmallIcon ( org.ovirt.engine.api.restapi.resource.IconTestHelpler.createIcon ( GUIDS [ 2 ] ) ) ; model.setLargeIcon ( org.ovirt.engine.api.restapi.resource.IconTestHelpler.createIconWithData ( ) ) ; try { verifyModel ( resource.update ( model ) , 0 ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BAD_REQUEST ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.VdsNetworkInterface createNicSyncedWithNetwork ( java.lang.String nicName , org.ovirt.engine.core.common.businessentities.Network network ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface nic = createVdsInterface ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , nicName , false , null , network.getvlan_id ( ) , network.getName ( ) , network.isVmNetwork ( ) ) ; return nic ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createNicSyncedWithNetwork ( java.lang.String nicName , org.ovirt.engine.core.common.businessentities.network.Network network ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createVdsInterface ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , nicName , false , null , network.getvlan_id ( ) , network.getName ( ) , network.isVmNetwork ( ) ) ; return nic ; }
Source:
public void testGetAllByStoragePoolAndConnectionWithInvalidInput ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > result = dao.getAllByStoragePoolAndConnection ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertTrue ( result.isEmpty ( ) ) ; }

Target:
public void testGetAllByStoragePoolAndConnectionWithInvalidInput ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > result = dao.getAllByStoragePoolAndConnection ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.junit.Assert.assertTrue ( result.isEmpty ( ) ) ; }
Source:
private void mockBackend ( ) { org.mockito.Mockito.doReturn ( backend ) . when ( addClusterCommand ) . getBackend ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase addClusterReturnValue = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.action.VdcReturnValueBase.class ) ; org.mockito.Mockito.when ( addClusterReturnValue.getSucceeded ( ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( backend.runAction ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.action.VdcActionType.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.action.CpuProfileParameters.class ) ) ) . thenReturn ( addClusterReturnValue ) ; }

Target:
private void mockBackend ( ) { org.ovirt.engine.core.common.action.VdcReturnValueBase addClusterReturnValue = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.action.VdcReturnValueBase.class ) ; org.mockito.Mockito.when ( addClusterReturnValue.getSucceeded ( ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( backend.runAction ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.action.VdcActionType.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.action.CpuProfileParameters.class ) ) ) . thenReturn ( addClusterReturnValue ) ; }