auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void setGatewayIfNecessary ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.VDS host , java.lang.String gateway ) { final org.ovirt.engine.core.bll.network.cluster.ManagementNetworkUtil managementNetworkUtil = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectsBuilder.getManagementNetworkUtil ( ) ; if ( ( ( org.ovirt.engine.core.common.FeatureSupported.multipleGatewaysSupported ( host.getVdsGroupCompatibilityVersion ( ) ) ) || ( managementNetworkUtil.isManagementNetwork ( iface.getNetworkName ( ) , host.getVdsGroupId ( ) ) ) ) || ( iface.getName ( ) . equals ( host.getActiveNic ( ) ) ) ) { iface.setGateway ( gateway ) ; } }

Target:
public static void setGatewayIfNecessary ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.VDS host , java.lang.String gateway ) { final org.ovirt.engine.core.bll.network.cluster.ManagementNetworkUtil managementNetworkUtil = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectsBuilder.getManagementNetworkUtil ( ) ; if ( ( ( org.ovirt.engine.core.common.FeatureSupported.multipleGatewaysSupported ( host.getClusterCompatibilityVersion ( ) ) ) || ( managementNetworkUtil.isManagementNetwork ( iface.getNetworkName ( ) , host.getClusterId ( ) ) ) ) || ( iface.getName ( ) . equals ( host.getActiveNic ( ) ) ) ) { iface.setGateway ( gateway ) ; } }
Source:
public static void getStorageDomainList ( 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 ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }

Target:
public static void getClusterList ( 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 ) { 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.GetAllVdsGroups , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
public void postOnCreateVolume ( org.ovirt.engine.core.common.action.VdcReturnValueBase returnValue ) { org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel ) ( getWindow ( ) ) ) ; model.StopProgress ( ) ; if ( ( returnValue != null ) && ( returnValue.getSucceeded ( ) ) ) { cancel ( ) ; } }

Target:
public void postOnCreateVolume ( org.ovirt.engine.core.common.action.VdcReturnValueBase returnValue ) { org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel ) ( getWindow ( ) ) ) ; model.StopProgress ( ) ; if ( ( returnValue != null ) && ( returnValue.getSucceeded ( ) ) ) { cancel ( ) ; org.ovirt.engine.core.compat.Guid volumeId = ( ( org.ovirt.engine.core.compat.Guid ) ( returnValue.getActionReturnValue ( ) ) ) ; if ( ( ( java.lang.Boolean ) ( model.getOptimizeForVirtStore ( ) . getEntity ( ) ) ) ) { optimizeVolumesForVirtStore ( java.util.Arrays.asList ( volumeId ) ) ; } } }
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 snapshot ( java.lang.String vmId , java.util.Map < java.lang.String , java.lang.String > [ ] disks , java.lang.String memory , boolean frozen ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.snapshot ( vmId , disks , memory , frozen ) ; 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:
protected void buildVmBootOptions ( ) { if ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( vm.getinitrd_url ( ) ) ) ) { createInfo.add ( VdsProperties.InitrdUrl , vm.getinitrd_url ( ) ) ; } if ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( vm.getkernel_url ( ) ) ) ) { createInfo.add ( VdsProperties.KernelUrl , vm.getkernel_url ( ) ) ; if ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( vm.getkernel_params ( ) ) ) ) { createInfo.add ( VdsProperties.KernelParams , vm.getkernel_params ( ) ) ; } } }

Target:
protected void buildVmBootOptions ( ) { if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( vm.getinitrd_url ( ) ) ) ) { createInfo.add ( VdsProperties.InitrdUrl , vm.getinitrd_url ( ) ) ; } if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( vm.getkernel_url ( ) ) ) ) { createInfo.add ( VdsProperties.KernelUrl , vm.getkernel_url ( ) ) ; if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( vm.getkernel_params ( ) ) ) ) { createInfo.add ( VdsProperties.KernelParams , vm.getkernel_params ( ) ) ; } } }
Source:
public void customPropertiesNetworkRemoved ( ) { mockExistingNetworks ( ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNic ( "eth0" , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; iface.setCustomProperties ( createCustomProperties ( ) ) ; mockExistingIfaces ( iface ) ; iface.setNetworkName ( null ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( iface ) , Version.v3_5 ) ; validateAndAssertNetworkRemoved ( helper , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; }

Target:
public void customPropertiesNetworkRemoved ( ) { mockExistingNetworks ( ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createManagementNetworkNic ( "eth0" ) ; iface.setCustomProperties ( createCustomProperties ( ) ) ; mockExistingIfaces ( iface ) ; iface.setNetworkName ( null ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( iface ) , Version.v3_5 ) ; validateAndAssertNetworkRemoved ( helper , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; }
Source:
protected java.lang.Long getRawValue ( org.ovirt.engine.core.common.businessentities.storage.Disk object ) { return ( object.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.Disk.DiskStorageType.IMAGE ) ? java.lang.Math.round ( ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( object ) ) . getActualDiskWithSnapshotsSize ( ) ) : ( ( long ) ( ( ( org.ovirt.engine.core.common.businessentities.LunDisk ) ( object ) ) . getLun ( ) . getDeviceSize ( ) ) ) ; }

Target:
protected java.lang.Long getRawValue ( org.ovirt.engine.core.common.businessentities.storage.Disk object ) { return ( object.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE ) ? java.lang.Math.round ( ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( object ) ) . getActualDiskWithSnapshotsSize ( ) ) : ( ( long ) ( ( ( org.ovirt.engine.core.common.businessentities.storage.LunDisk ) ( object ) ) . getLun ( ) . getDeviceSize ( ) ) ) ; }
Source:
private static void MovePoolToProblematicInDB ( org.ovirt.engine.core.common.businessentities.storage_pool storagePool , boolean resetSpmInDB ) { org.ovirt.engine.core.vdsbroker.ResourceManager.getInstance ( ) . getEventListener ( ) . storagePoolStatusChange ( storagePool.getId ( ) , StoragePoolStatus.Problematic , AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC , VdcBllErrors.ENGINE ) ; if ( resetSpmInDB ) { storagePool.setspm_vds_id ( null ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStoragePoolDao ( ) . update ( storagePool ) ; } }

Target:
private void movePoolToProblematicInDB ( org.ovirt.engine.core.common.businessentities.storage_pool storagePool , boolean resetSpmInDB ) { org.ovirt.engine.core.vdsbroker.ResourceManager.getInstance ( ) . getEventListener ( ) . storagePoolStatusChange ( storagePool.getId ( ) , StoragePoolStatus.Problematic , AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC , VdcBllErrors.ENGINE ) ; if ( resetSpmInDB ) { storagePool.setspm_vds_id ( null ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStoragePoolDao ( ) . update ( storagePool ) ; } }
Source:
public void executeCommandWhenFailed ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( CLUSTER_ID , HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackend ( cmd , false ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.never ( ) ) . addServerHookInDb ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook.class ) ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE_FAILED ) ; }

Target:
public void executeCommandWhenFailed ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , false ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE_FAILED ) ; }
Source:
private void mockGetImageDomainsListVdsCommand ( ) { java.util.ArrayList < org.ovirt.engine.core.compat.Guid > guids = new java.util.ArrayList < org.ovirt.engine.core.compat.Guid > ( 1 ) ; guids.add ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = new org.ovirt.engine.core.common.vdscommands.VDSReturnValue ( ) ; returnValue.setReturnValue ( guids ) ; org.mockito.Mockito.when ( vdsBrokerFrontend.RunVdsCommand ( org.mockito.Matchers.eq ( VDSCommandType.GetImageDomainsList ) , org.mockito.Matchers.< org.ovirt.engine.core.common.vdscommands.VDSParametersBase > any ( org.ovirt.engine.core.common.vdscommands.VDSParametersBase.class ) ) ) . thenReturn ( returnValue ) ; }

Target:
private void mockOsRepository ( ) { org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; }
Source:
public com.google.gwt.resources.client.ImageResource getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel object ) { org.ovirt.engine.core.common.businessentities.Disk disk = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( object.getEntity ( ) ) ) . getDisk ( ) ; setTitle ( ( disk.isBoot ( ) ? constants.bootableDisk ( ) : null ) ) ; return disk.isBoot ( ) ? resources.bootableDiskIcon ( ) : null ; }

Target:
protected org.ovirt.engine.core.common.businessentities.storage.DiskInterface getRawValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel object ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel ) ( object.getEntity ( ) ) ) . getDisk ( ) ; return disk.getDiskInterface ( ) ; }
Source:
private void run ( ) { java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > list = new java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) ; for ( java.lang.Object item : getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.VM a = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( item ) ) ; list.add ( new org.ovirt.engine.core.common.action.RunVmParams ( a.getId ( ) ) ) ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runMultipleAction ( VdcActionType.RunVm , list , new org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { } } , null ) ; }

Target:
protected org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] getClonedAppendedNameValidators ( java.lang.Object object ) { final int maxClonedNameLength = getMaxClonedNameLength ( object ) ; return new org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] { new org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation ( ) , new org.ovirt.engine.ui.uicommonweb.validation.LengthValidation ( maxClonedNameLength ) , new org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation ( ) { @ java.lang.Override protected java.lang.String composeMessage ( ) { return org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getMessages ( ) . newNameWithSuffixCannotContainBlankOrSpecialChars ( maxClonedNameLength ) ; } } , new org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel.UniqueClonedAppendedNameValidator ( assignedVmNames ) } ; }
Source:
protected void addVmWatchdog ( ) { org.ovirt.engine.core.common.businessentities.VmWatchdog vmWatchdog = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getWatchdog ( ) ; if ( vmWatchdog != null ) { org.ovirt.engine.core.common.action.WatchdogParameters parameters = new org.ovirt.engine.core.common.action.WatchdogParameters ( ) ; parameters.setId ( org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmId ( ) ) ; parameters.setAction ( vmWatchdog.getAction ( ) ) ; parameters.setModel ( vmWatchdog.getModel ( ) ) ; runInternalAction ( VdcActionType.AddWatchdog , parameters , org.ovirt.engine.core.bll.AddVmCommand.cloneContextAndDetachFromParent ( ) ) ; } }

Target:
protected void addVmWatchdog ( ) { org.ovirt.engine.core.common.businessentities.VmWatchdog vmWatchdog = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getWatchdog ( ) ; if ( vmWatchdog != null ) { org.ovirt.engine.core.common.action.VdcActionType actionType = ( org.ovirt.engine.core.bll.utils.VmDeviceUtils.hasWatchdog ( org.ovirt.engine.core.bll.AddVmCommand.getVmTemplateId ( ) ) ) ? org.ovirt.engine.core.common.action.VdcActionType.UpdateWatchdog : org.ovirt.engine.core.common.action.VdcActionType.AddWatchdog ; runInternalAction ( actionType , buildWatchdogParameters ( vmWatchdog ) , org.ovirt.engine.core.bll.AddVmCommand.cloneContextAndDetachFromParent ( ) ) ; } }
Source:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.AddRoleCommand.getRoleDao ( ) . getByName ( org.ovirt.engine.core.bll.AddRoleCommand.getRoleName ( ) ) ) != null ) { addCanDoActionMessage ( VdcBllMessages.VAR__ACTION__ADD ) ; addCanDoActionMessage ( VdcBllMessages.ERROR_CANNOT_UPDATE_ROLE_NAME ) ; returnValue = false ; } return returnValue ; }

Target:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.AddRoleCommand.getRoleDao ( ) . getByName ( org.ovirt.engine.core.bll.AddRoleCommand.getRoleName ( ) ) ) != null ) { addCanDoActionMessage ( VdcBllMessages.VAR__ACTION__ADD ) ; addCanDoActionMessage ( VdcBllMessages.VAR__TYPE__ROLE ) ; addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED ) ; returnValue = false ; } return returnValue ; }
Source:
private boolean getItemOldState ( java.lang.Object userObject ) { for ( java.lang.Object oldUserObject : oldItemStatesMap.keySet ( ) ) { if ( ( ( oldUserObject != null ) && ( userObject != null ) ) && ( oldUserObject.equals ( userObject ) ) ) { return oldItemStatesMap.get ( oldUserObject ) ; } } return false ; }

Target:
private boolean getItemOldState ( java.lang.Object userObject ) { for ( java.util.Map.Entry < java.lang.Object , java.lang.Boolean > oldItemStatesEntry : oldItemStatesMap.entrySet ( ) ) { if ( ( ( ( oldItemStatesEntry.getKey ( ) ) != null ) && ( userObject != null ) ) && ( oldItemStatesEntry.getKey ( ) . equals ( userObject ) ) ) { return oldItemStatesEntry.getValue ( ) ; } } return false ; }
Source:
protected boolean canDoAction ( ) { if ( validateParameters ( ) ) { org.ovirt.engine.core.bll.validator.NetworkQosValidator validator = new org.ovirt.engine.core.bll.validator.NetworkQosValidator ( getNetworkQoS ( ) ) ; return ( validate ( validator.qosExists ( ) ) ) && ( validate ( validator.consistentDataCenter ( ) ) ) ; } return true ; }

Target:
protected org.ovirt.engine.core.dao.qos.QosDao < org.ovirt.engine.core.common.businessentities.network.NetworkQoS > getQosDao ( ) { return getDbFacade ( ) . getNetworkQosDao ( ) ; }
Source:
public void rollback ( ) { log.errorFormat ( "Transaction rolled-back for command: {0}." , this . getClass ( ) . getName ( ) ) ; try { if ( isQuotaDependant ( ) ) { rollBackQuota ( ) ; } } catch ( java.lang.NullPointerException e ) { log.debug ( "RollbackQuota: failed (may be because quota is disabled)" , e ) ; } cancelTasks ( ) ; }

Target:
public void rollback ( ) { log.errorFormat ( "Transaction rolled-back for command: {0}." , this . getClass ( ) . getName ( ) ) ; try { if ( isQuotaDependant ( ) ) { rollbackQuota ( ) ; } } catch ( java.lang.NullPointerException e ) { log.debug ( "RollbackQuota: failed (may be because quota is disabled)" , e ) ; } cancelTasks ( ) ; }
Source:
public void testNotRemovingUsedPoolRecordIsUsed ( ) throws java.lang.Exception { macPool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( macPoolDaoMock.getDcUsageCount ( org.mockito.Matchers.eq ( macPool.getId ( ) ) ) ) . thenReturn ( 1 ) ; org.junit.Assert.assertThat ( new org.ovirt.engine.core.bll.MacPoolValidator ( macPool ) . notRemovingUsedPool ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_STILL_USED_MAC_POOL ) ) ; }

Target:
public void testNotRemovingUsedPoolRecordNotUsed ( ) throws java.lang.Exception { macPool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( storagePoolDao.getAllDataCentersByMacPoolId ( macPool.getId ( ) ) ) . thenReturn ( java.util.Collections.< org.ovirt.engine.core.common.businessentities.StoragePool > emptyList ( ) ) ; org.junit.Assert.assertThat ( macPoolValidator.notRemovingUsedPool ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
public void testValidDedicatedHost ( ) { prepareVmToPassCanDoAction ( ) ; org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setvds_group_id ( group.getId ( ) ) ; org.mockito.Mockito.doReturn ( vdsDAO ) . when ( command ) . getVdsDAO ( ) ; org.mockito.Mockito.when ( vdsDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vds ) ; vmStatic.setdedicated_vm_for_vds ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; junit.framework.Assert.assertTrue ( "canDoAction should have passed." , command.canDoAction ( ) ) ; }

Target:
public void testValidDedicatedHost ( ) { prepareVmToPassCanDoAction ( ) ; org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setvds_group_id ( group.getId ( ) ) ; org.mockito.Mockito.doReturn ( vdsDAO ) . when ( command ) . getVdsDAO ( ) ; org.mockito.Mockito.when ( vdsDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vds ) ; vmStatic.setDedicatedVmForVds ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; junit.framework.Assert.assertTrue ( "canDoAction should have passed." , command.canDoAction ( ) ) ; }
Source:
public void testEnoughSpaceToMergeSnapshotsWithOneDisk ( ) { spySdValidatorForOneDomain ( ) ; org.mockito.Mockito.when ( diskImageDAO.get ( mockSourceImage ( ) ) ) . thenReturn ( new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ) ; mockStorageDomainDAOGetForStoragePool ( 10 , org.ovirt.engine.core.bll.RemoveSnapshotCommandTest.STORAGE_DOMAIN_ID ) ; org.junit.Assert.assertTrue ( "Validation should succeed. Free space minus threshold should be bigger then disk size" , cmd.validateStorageDomains ( ) ) ; }

Target:
public void testCanDoActionNotEnoughSpace ( ) { prepareForVmValidatorTests ( ) ; spySdValidator ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( vmValidator ) . vmHostCanLiveMerge ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > imagesDisks = mockDisksList ( 4 ) ; org.mockito.Mockito.when ( storageDomainsValidator.allDomainsHaveSpaceForClonedDisks ( imagesDisks ) ) . thenReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ; }
Source:
void showModels ( java.util.List < org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceLineModel > interfaceLineModels ) { this . setVisible ( true ) ; grid.resizeRows ( interfaceLineModels.size ( ) ) ; int row = 0 ; for ( org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceLineModel lineModel : interfaceLineModels ) { setGridWidget ( row , 0 , createInterfacePanel ( lineModel ) ) ; setGridWidget ( row , 1 , createBondPanel ( lineModel ) ) ; setGridWidget ( row , 2 , createVLanPanel ( lineModel ) ) ; row ++ ; } }

Target:
void showModels ( java.util.List < org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceLineModel > interfaceLineModels ) { this . setVisible ( true ) ; grid.resizeRows ( interfaceLineModels.size ( ) ) ; int row = 0 ; for ( org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceLineModel lineModel : interfaceLineModels ) { setGridWidget ( row , 0 , createInterfacePanel ( lineModel ) ) ; setGridWidget ( row , 1 , createBondPanel ( lineModel ) ) ; setGridWidget ( row , 2 , createVLanPanel ( lineModel ) ) ; setGridWidget ( row , 3 , createStatisticsPanel ( lineModel ) ) ; row ++ ; } }
Source:
static org.ovirt.engine.api.model.VM getModel ( int index ) { org.ovirt.engine.api.model.VM model = new org.ovirt.engine.api.model.VM ( ) ; model.setName ( NAMES [ index ] ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setCluster ( new org.ovirt.engine.api.model.Cluster ( ) ) ; model.getCluster ( ) . setId ( GUIDS [ 2 ] . toString ( ) ) ; return model ; }

Target:
static org.ovirt.engine.api.model.Vm getModel ( int index ) { org.ovirt.engine.api.model.Vm model = new org.ovirt.engine.api.model.Vm ( ) ; model.setName ( NAMES [ index ] ) ; model.setDescription ( DESCRIPTIONS [ index ] ) ; model.setId ( GUIDS [ index ] . toString ( ) ) ; model.setCluster ( new org.ovirt.engine.api.model.Cluster ( ) ) ; model.getCluster ( ) . setId ( GUIDS [ 2 ] . toString ( ) ) ; return model ; }
Source:
private static org.ovirt.engine.core.common.businessentities.DisplayType parseDisplayType ( java.util.Map < java.lang.String , java.lang.Object > xmlRpcStruct ) { try { java.lang.String displayTypeStr = xmlRpcStruct.get ( VdsProperties.displayType ) . toString ( ) ; return org.ovirt.engine.core.common.businessentities.DisplayType.valueOf ( displayTypeStr ) ; } catch ( java.lang.Exception e ) { return null ; } }

Target:
private static org.ovirt.engine.core.common.businessentities.GraphicsType parseGraphicsType ( java.util.Map < java.lang.String , java.lang.Object > xmlRpcStruct ) { org.ovirt.engine.core.common.businessentities.GraphicsType result = null ; try { java.lang.String displayTypeStr = xmlRpcStruct.get ( VdsProperties.displayType ) . toString ( ) ; switch ( displayTypeStr ) { case VdsProperties.VNC : result = org.ovirt.engine.core.common.businessentities.GraphicsType.VNC ; break ; case VdsProperties.QXL : result = org.ovirt.engine.core.common.businessentities.GraphicsType.SPICE ; break ; } } catch ( java.lang.Exception e ) { } return result ; }
Source:
private void createCommand ( ) { org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase params = new org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase ( ) ; params.setStorageDomainId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; params.setStoragePoolId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand < org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase > ( params ) ) ; org.mockito.Mockito.doReturn ( storageDomainDAO ) . when ( cmd ) . getStorageDomainDAO ( ) ; org.mockito.Mockito.doReturn ( storagePoolDAO ) . when ( cmd ) . getStoragePoolDAO ( ) ; }

Target:
private void createCommand ( ) { org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase params = new org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase ( ) ; params.setStorageDomainId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; params.setStoragePoolId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand < org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase > ( params ) ) ; org.mockito.Mockito.doReturn ( storageDomainDAO ) . when ( cmd ) . getStorageDomainDAO ( ) ; org.mockito.Mockito.doReturn ( storagePoolDAO ) . when ( cmd ) . getStoragePoolDAO ( ) ; org.mockito.Mockito.doReturn ( vdsDAO ) . when ( cmd ) . getVdsDAO ( ) ; }
Source:
public void getValueWithMultipleVersions ( ) throws java.lang.Exception { final java.lang.String key = "MaxNumOfVmSockets" ; org.ovirt.engine.core.config.EngineConfigTest.log.info ( "getValue: Testing fetch multiple version of {}" , key ) ; java.util.List < org.ovirt.engine.core.config.entity.ConfigKey > keys = config.getEngineConfigLogic ( ) . getConfigDao ( ) . getKeysForName ( key ) ; for ( org.ovirt.engine.core.config.entity.ConfigKey configKey : keys ) { org.ovirt.engine.core.config.EngineConfigTest.log.info ( "{} version: {}" , configKey.getDisplayValue ( ) , configKey.getVersion ( ) ) ; } org.junit.Assert.assertTrue ( ( ( keys.size ( ) ) > 0 ) ) ; }

Target:
public void getValueWithMultipleVersions ( ) throws java.lang.Exception { final java.lang.String key = "MaxNumOfVmSockets" ; org.ovirt.engine.core.config.EngineConfigTest.log.info ( "getValue: Testing fetch multiple version of {}" , key ) ; java.util.List < org.ovirt.engine.core.config.entity.ConfigKey > keys = config.getEngineConfigLogic ( ) . getConfigDao ( ) . getKeysForName ( key ) ; for ( org.ovirt.engine.core.config.entity.ConfigKey configKey : keys ) { org.ovirt.engine.core.config.EngineConfigTest.log.info ( "{} version: {}" , configKey.getDisplayValue ( ) , configKey.getVersion ( ) ) ; } org.junit.jupiter.api.Assertions.assertTrue ( ( ( keys.size ( ) ) > 0 ) ) ; }
Source:
protected org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel determineConsoleModelFromVm ( org.ovirt.engine.core.common.businessentities.VM vm , java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel > cachedModels ) { return ( vm.getDefaultDisplayType ( ) ) == ( org.ovirt.engine.core.common.businessentities.DisplayType.vnc ) ? cachedModels.get ( org.ovirt.engine.ui.uicommonweb.models.userportal.IUserPortalListModel.VNC_INDEX ) : cachedModels.get ( org.ovirt.engine.ui.uicommonweb.models.userportal.IUserPortalListModel.SPICE_INDEX ) ; }

Target:
protected org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel determineConsoleModelFromVm ( org.ovirt.engine.core.common.businessentities.VM vm , java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleModel > cachedModels ) { org.ovirt.engine.core.common.businessentities.DisplayType vmDisplayType = ( vm.isRunningOrPaused ( ) ) ? vm.getDisplayType ( ) : vm.getDefaultDisplayType ( ) ; return cachedModels.get ( ( vmDisplayType == ( org.ovirt.engine.core.common.businessentities.DisplayType.vnc ) ? org.ovirt.engine.ui.uicommonweb.models.userportal.IUserPortalListModel.VNC_INDEX : org.ovirt.engine.ui.uicommonweb.models.userportal.IUserPortalListModel.SPICE_INDEX ) ) ; }
Source:
private void generateWriterSource ( org.ovirt.api.metamodel.concepts.StructType type ) { org.ovirt.api.metamodel.tool.JavaClassName writerName = javaTypes.getJsonWriterName ( type ) ; javaBuffer.addLine ( "public class %1$s {" , writerName.getSimpleName ( ) ) ; javaBuffer.addLine ( ) ; generateWriteOne ( type ) ; generateWriteMany ( type ) ; javaBuffer.addLine ( "}" ) ; javaBuffer.addLine ( ) ; }

Target:
private void generateStructWriterSource ( org.ovirt.api.metamodel.concepts.StructType type ) { org.ovirt.api.metamodel.tool.JavaClassName writerName = javaTypes.getJsonWriterName ( type ) ; javaBuffer.addLine ( "public class %1$s {" , writerName.getSimpleName ( ) ) ; javaBuffer.addLine ( ) ; generateStructWriteOne ( type ) ; generateStructWriteMany ( type ) ; javaBuffer.addLine ( "}" ) ; javaBuffer.addLine ( ) ; }
Source:
public void testMissingParameterSpecificReason ( ) throws java.lang.Exception { org.ovirt.engine.api.model.VM vm = new org.ovirt.engine.api.model.VM ( ) ; vm.setDescription ( "incomplete" ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( "Missing stuff" , "{0} {1} required for {2}" , vm , "status" ) ; fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( "Missing stuff" , wae , "VM" , "status" ) ; } }

Target:
public void testMissingParameterSpecificReason ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Vm vm = new org.ovirt.engine.api.model.Vm ( ) ; vm.setDescription ( "incomplete" ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( "Missing stuff" , "{0} {1} required for {2}" , vm , "status" ) ; fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( "Missing stuff" , wae , "Vm" , "status" ) ; } }
Source:
public void testGetAllSupportedNetworkFiltersByVersionLatestVersion ( ) { final org.ovirt.engine.core.compat.Version version = new org.ovirt.engine.core.compat.Version ( "4.0" ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.network.NetworkFilter > allNetworkFilter = dao.getAllSupportedNetworkFiltersByVersion ( version ) ; org.junit.Assert.assertNotNull ( allNetworkFilter ) ; org.junit.Assert.assertEquals ( 2 , allNetworkFilter.size ( ) ) ; org.ovirt.engine.core.common.businessentities.network.NetworkFilter expectedNetworkFilter = initOvirtNoFilter ( ) ; org.junit.Assert.assertEquals ( expectedNetworkFilter , allNetworkFilter.get ( 1 ) ) ; expectedNetworkFilter = expectedNetworkFilter ( ) ; org.junit.Assert.assertEquals ( expectedNetworkFilter , allNetworkFilter.get ( 0 ) ) ; }

Target:
public void testGetAllSupportedNetworkFiltersByVersion ( ) { final org.ovirt.engine.core.compat.Version version = new org.ovirt.engine.core.compat.Version ( "4.0" ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.network.NetworkFilter > allNetworkFilter = dao.getAllSupportedNetworkFiltersByVersion ( version ) ; org.junit.Assert.assertNotNull ( allNetworkFilter ) ; org.junit.Assert.assertEquals ( 3 , allNetworkFilter.size ( ) ) ; org.ovirt.engine.core.common.businessentities.network.NetworkFilter expectedNetworkFilter = initOvirtNoFilter ( ) ; org.junit.Assert.assertEquals ( expectedNetworkFilter , allNetworkFilter.get ( 1 ) ) ; expectedNetworkFilter = expectedNetworkFilter ( ) ; org.junit.Assert.assertEquals ( expectedNetworkFilter , allNetworkFilter.get ( 0 ) ) ; }
Source:
public void validateIsoPrefixForInitrdAndNoPrefixForKernel ( ) throws java.lang.Exception { java.lang.String initrd = "initrd" ; java.lang.String kernel = "kernel" ; org.ovirt.engine.core.common.businessentities.VM vm = createVmForTesting ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ISO_PREFIX ) + initrd ) , kernel ) ; org.junit.Assert.assertEquals ( vm.getInitrdUrl ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + initrd ) ) ; org.junit.Assert.assertEquals ( vm.getKernelUrl ( ) , kernel ) ; }

Target:
public void validateIsoPrefixForInitrdAndNoPrefixForKernel ( ) throws java.lang.Exception { java.lang.String initrd = "initrd" ; java.lang.String kernel = "kernel" ; org.ovirt.engine.core.common.businessentities.VM vm = createVmForTesting ( ( ( RunVmCommand.ISO_PREFIX ) + initrd ) , kernel ) ; org.junit.Assert.assertEquals ( vm.getInitrdUrl ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + initrd ) ) ; org.junit.Assert.assertEquals ( vm.getKernelUrl ( ) , kernel ) ; }
Source:
protected boolean acquireLock ( ) { org.ovirt.engine.core.bll.LockIdNameAttribute annotation = getClass ( ) . getAnnotation ( org.ovirt.engine.core.bll.LockIdNameAttribute.class ) ; boolean returnValue = true ; if ( annotation != null ) { releaseLocksAtEndOfExecute = annotation.isReleaseAtEndOfExecute ( ) ; if ( ! ( annotation.isWait ( ) ) ) { returnValue = acquireLockInternal ( ) ; } else { acquireLockAndWait ( ) ; } } return returnValue ; }

Target:
public void setCommandStatus ( org.ovirt.engine.core.compat.CommandStatus status ) { setCommandStatus ( status , true ) ; }
Source:
public void successfulStatusWithSpecifiedFenceAgent ( ) { mockFenceResult ( agentExecutor1 , new org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult.Status.SUCCESS , org.ovirt.engine.core.common.businessentities.pm.PowerStatus.ON ) ) ; org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult result = executor.getFenceAgentStatus ( createFenceAgent ( 1 ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( Status.SUCCESS , result.getStatus ( ) ) ; org.junit.Assert.assertEquals ( PowerStatus.ON , result.getPowerStatus ( ) ) ; }

Target:
public void successfulStatusWithSpecifiedFenceAgent ( ) { mockFenceResult ( agentExecutor1 , new org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult ( org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult.Status.SUCCESS , org.ovirt.engine.core.common.businessentities.pm.PowerStatus.ON ) ) ; org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult result = executor.getFenceAgentStatus ( createFenceAgent ( 1 ) ) ; org.junit.jupiter.api.Assertions.assertNotNull ( result ) ; org.junit.jupiter.api.Assertions.assertEquals ( Status.SUCCESS , result.getStatus ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( PowerStatus.ON , result.getPowerStatus ( ) ) ; }
Source:
public void validateNoFreeSpacePctOnDomains ( ) { setupMocks ( ) ; mockGetImageDomainsListVdsCommand ( 2 , 2 ) ; org.ovirt.engine.core.bll.AddVmPoolWithVmsCommand < org.ovirt.engine.core.common.action.AddVmPoolWithVmsParameters > cmd = createCommand ( ) ; org.mockito.Mockito.when ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.FreeSpaceLow ) ) . thenReturn ( 50 ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW.toString ( ) ) ) ; }

Target:
public void validateNoFreeSpacePctOnDomains ( ) { mockGetImageDomainsListVdsCommand ( 2 , 2 ) ; mcr.mockConfigValue ( ConfigValues.FreeSpaceLow , 50 ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW.toString ( ) ) ) ; }
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 ) ) ; org.ovirt.engine.core.common.businessentities.VmTemplate template = ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( returnValue ) ) ; model.getTemplate ( ) . setItems ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > ( java.util.Arrays.asList ( new org.ovirt.engine.core.common.businessentities.VmTemplate [ ] { template } ) ) ) ; model.getTemplate ( ) . setSelectedItem ( template ) ; model.getTemplate ( ) . setIsChangable ( false ) ; postInitTemplate ( ) ; }

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

Target:
public static void getHostPublicKey ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetServerSSHPublicKey , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
public void testSaveUserWithTooManyGroups ( ) { org.ovirt.engine.core.common.businessentities.DbUser tooManyGroupsUser = new org.ovirt.engine.core.common.businessentities.DbUser ( ) ; tooManyGroupsUser.setExternalId ( new org.ovirt.engine.core.common.utils.ExternalId ( 0 ) ) ; tooManyGroupsUser.setFirstName ( "I" ) ; tooManyGroupsUser.setLastName ( "Have" ) ; tooManyGroupsUser.setLoginName ( "too" ) ; tooManyGroupsUser.setEmail ( "many@redhat.com" ) ; tooManyGroupsUser.setDomain ( "domain" ) ; tooManyGroupsUser.setGroupNames ( "groups" ) ; tooManyGroupsUser.setGroupIds ( org.apache.commons.lang.StringUtils.leftPad ( "groups" , 2048 ) ) ; dao.save ( tooManyGroupsUser ) ; org.ovirt.engine.core.common.businessentities.DbUser result = dao.getByUsername ( tooManyGroupsUser.getLoginName ( ) ) ; org.junit.Assert.assertEquals ( tooManyGroupsUser , result ) ; }

Target:
public void testSaveUserWithTooManyGroups ( ) { org.ovirt.engine.core.common.businessentities.DbUser tooManyGroupsUser = new org.ovirt.engine.core.common.businessentities.DbUser ( ) ; tooManyGroupsUser.setExternalId ( new org.ovirt.engine.core.common.utils.ExternalId ( 0 ) ) ; tooManyGroupsUser.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; tooManyGroupsUser.setFirstName ( "I" ) ; tooManyGroupsUser.setLastName ( "Have" ) ; tooManyGroupsUser.setLoginName ( "too" ) ; tooManyGroupsUser.setEmail ( "many@redhat.com" ) ; tooManyGroupsUser.setDomain ( "domain" ) ; tooManyGroupsUser.setGroupNames ( "groups" ) ; tooManyGroupsUser.setGroupIds ( org.apache.commons.lang.StringUtils.leftPad ( "groups" , 2048 ) ) ; dao.save ( tooManyGroupsUser ) ; org.ovirt.engine.core.common.businessentities.DbUser result = dao.getByUsername ( tooManyGroupsUser.getLoginName ( ) ) ; org.junit.Assert.assertEquals ( tooManyGroupsUser , result ) ; }
Source:
public void OnSuccess ( java.lang.Object model , java.lang.Object result ) { java.lang.String fingerprint = ( ( java.lang.String ) ( result ) ) ; if ( ( fingerprint != null ) && ( ( fingerprint.length ( ) ) > 0 ) ) { getGlusterHostFingerprint ( ) . setEntity ( result ) ; setIsFingerprintVerified ( true ) ; } else { getGlusterHostFingerprint ( ) . setEntity ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . errorLoadingFingerprint ( ) ) ; setIsFingerprintVerified ( false ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.core.compat.Event ev , java.lang.Object sender , org.ovirt.engine.core.compat.EventArgs args ) { setIsFingerprintVerified ( false ) ; fetchFingerprint ( ( ( java.lang.String ) ( getGlusterHostAddress ( ) . getEntity ( ) ) ) ) ; }
Source:
private org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidator createHostSetupNetworksValidator ( org.ovirt.engine.core.common.action.HostSetupNetworksParameters params , java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > existingIfaces , java.util.List < org.ovirt.engine.core.common.businessentities.network.NetworkAttachment > existingAttachments , java.util.Collection < org.ovirt.engine.core.common.businessentities.network.Network > networks ) { return new org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidatorTest.HostSetupNetworksValidatorBuilder ( ) . setHost ( host ) . setParams ( params ) . setExistingInterfaces ( existingIfaces ) . setExistingAttachments ( existingAttachments ) . addNetworks ( networks ) . build ( ) ; }

Target:
public org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidatorTest.ParametersBuilder addRemovedLabels ( java.lang.String ... removedLabels ) { if ( nullParameters ( removedLabels ) ) { return this ; } if ( ( parameters.getRemovedLabels ( ) ) == null ) { parameters.setRemovedLabels ( new java.util.HashSet < java.lang.String > ( ) ) ; } parameters.getRemovedLabels ( ) . addAll ( java.util.Arrays.asList ( removedLabels ) ) ; return this ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult notRemovingUsedPool ( ) { final org.ovirt.engine.core.dao.StoragePoolDao storagePoolDao = getDbFacade ( ) . getStoragePoolDao ( ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.StoragePool > dataCenters = storagePoolDao.getAllDataCentersByMacPoolId ( macPool.getId ( ) ) ; final java.util.Collection < java.lang.String > replacements = org.ovirt.engine.core.utils.ReplacementUtils.replaceWithNameable ( "DATACENTERS_USING_MAC_POOL" , dataCenters ) ; replacements.add ( VdcBllMessages.VAR__ENTITIES__DATA_CENTERS.name ( ) ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_STILL_USED_MAC_POOL , replacements.toArray ( new java.lang.String [ 0 ] ) ) . when ( ( ( dataCenters.size ( ) ) != 0 ) ) ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult notRemovingUsedPool ( ) { final org.ovirt.engine.core.dao.StoragePoolDao storagePoolDao = getDbFacade ( ) . getStoragePoolDao ( ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.StoragePool > dataCenters = storagePoolDao.getAllDataCentersByMacPoolId ( macPool.getId ( ) ) ; final java.util.Collection < java.lang.String > replacements = org.ovirt.engine.core.utils.ReplacementUtils.replaceWithNameable ( "DATACENTERS_USING_MAC_POOL" , dataCenters ) ; replacements.add ( EngineMessage.VAR__ENTITIES__DATA_CENTERS.name ( ) ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_STILL_USED_MAC_POOL , replacements.toArray ( new java.lang.String [ 0 ] ) ) . when ( ( ( dataCenters.size ( ) ) != 0 ) ) ; }
Source:
private void checkResults ( java.util.List < org.ovirt.engine.core.common.businessentities.profiles.CpuProfile > result ) { org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( 2 , result.size ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.profiles.CpuProfile cpuProfile : result ) { org.junit.Assert.assertEquals ( FixturesTool.VDS_GROUP_RHEL6_ISCSI , cpuProfile.getClusterId ( ) ) ; } }

Target:
private void checkResults ( java.util.List < org.ovirt.engine.core.common.businessentities.profiles.CpuProfile > result ) { org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( 2 , result.size ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.profiles.CpuProfile cpuProfile : result ) { org.junit.Assert.assertEquals ( FixturesTool.CLUSTER_RHEL6_ISCSI , cpuProfile.getClusterId ( ) ) ; } }
Source:
private void createUpStoragePool ( ) { org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; pool.setstatus ( StoragePoolStatus.Up ) ; org.mockito.Mockito.when ( storagePoolDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; }

Target:
private void createUpStoragePool ( ) { org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; pool.setStatus ( StoragePoolStatus.Up ) ; org.mockito.Mockito.when ( storagePoolDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; }
Source:
public void exampleForeach ( ) { java.util.List < java.lang.String > results = org.ovirt.engine.core.utils.linq.LinqUtils.foreach ( list , new org.ovirt.engine.core.utils.linq.Function < java.lang.String , java.lang.String > ( ) { @ java.lang.Override public java.lang.String eval ( java.lang.String s ) { return s.substring ( 0 , 1 ) ; } } ) ; org.junit.Assert.assertEquals ( results , cutlist ) ; }

Target:
public void exampleForeach ( ) { java.util.List < java.lang.String > results = org.ovirt.engine.core.utils.linq.LinqUtils.transformToList ( list , new org.ovirt.engine.core.utils.linq.Function < java.lang.String , java.lang.String > ( ) { @ java.lang.Override public java.lang.String eval ( java.lang.String s ) { return s.substring ( 0 , 1 ) ; } } ) ; org.junit.Assert.assertEquals ( results , cutlist ) ; }