auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void getNextAvailableDiskAliasNameByVMId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetNextAvailableDiskAliasNameByVMId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }

Target:
public static void getoVirtISOsList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? new java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ( ( ( java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ) ( source ) ) ) : new java.util.ArrayList < org.ovirt.engine.core.compat.RpmVersion > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetoVirtISOs , new org.ovirt.engine.core.common.queries.VdsIdParametersBase ( id ) , aQuery ) ; }
Source:
public void testGet ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpManagementNetworkExpectation ( ) ; control.replay ( ) ; final org.ovirt.engine.api.model.Cluster cluster = resource.get ( ) ; verifyModel ( cluster , 0 ) ; verifyManagementNetwork ( cluster ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpManagementNetworkExpectation ( ) ; control.replay ( ) ; final org.ovirt.engine.core.common.businessentities.Cluster cluster = resource.get ( ) ; verifyModel ( cluster , 0 ) ; verifyManagementNetwork ( cluster ) ; }
Source:
private boolean isGatewayInSync ( ) { java.lang.String gatewayDesiredValue = getPrimaryAddress ( ) . getGateway ( ) ; java.lang.String gatewayActualValue = iface.getIpv4Gateway ( ) ; boolean bothBlank = ( org.apache.commons.lang.StringUtils.isBlank ( gatewayDesiredValue ) ) && ( org.apache.commons.lang.StringUtils.isBlank ( gatewayActualValue ) ) ; return bothBlank || ( java.util.Objects.equals ( gatewayDesiredValue , gatewayActualValue ) ) ; }

Target:
private boolean isIpv4NetworkSubnetInSync ( ) { return getsSubnetUtilsInstance ( ) . equalSubnet ( iface.getIpv4Subnet ( ) , getIpv4PrimaryAddress ( ) . getNetmask ( ) ) ; }
Source:
public org.ovirt.engine.core.dal.VdcBllMessages validate ( org.ovirt.engine.core.common.businessentities.VDS vds , java.lang.StringBuilder sb , boolean isMigrate ) { org.ovirt.engine.core.dal.VdcBllMessages returnValue = validateRequiredNetworksAvailable ( vds ) ; if ( ( org.ovirt.engine.core.dal.VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_NETWORKS ) == returnValue ) { sb.append ( "is missing networks required by VM nics " ) . append ( org.ovirt.engine.core.common.businessentities.Entities.interfacesByNetworkName ( getVmNICs ( ) ) . keySet ( ) ) ; } else if ( ( org.ovirt.engine.core.dal.VdcBllMessages.ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK ) == returnValue ) { sb.append ( "is missing the cluster's display network" ) ; } return returnValue ; }

Target:
public org.ovirt.engine.core.common.errors.VdcBllMessages validate ( org.ovirt.engine.core.common.businessentities.VDS vds , java.lang.StringBuilder sb , boolean isMigrate ) { org.ovirt.engine.core.common.errors.VdcBllMessages returnValue = validateRequiredNetworksAvailable ( vds ) ; if ( ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_NETWORKS ) == returnValue ) { sb.append ( "is missing networks required by VM nics " ) . append ( org.ovirt.engine.core.common.businessentities.Entities.interfacesByNetworkName ( getVmNICs ( ) ) . keySet ( ) ) ; } else if ( ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK ) == returnValue ) { sb.append ( "is missing the cluster's display network" ) ; } return returnValue ; }
Source:
public void testList ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpGetEntityExpectations ( VdcQueryType.Search , org.ovirt.engine.core.common.queries.SearchParameters.class , new java.lang.String [ ] { "SearchPattern" , "SearchTypeValue" } , new java.lang.Object [ ] { "users:" , org.ovirt.engine.core.common.interfaces.SearchType.DBUser } , getUsers ( ) ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; verifyCollection ( getCollection ( ) ) ; }

Target:
public void testList ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpGetEntityExpectations ( VdcQueryType.GetDbUserByUserId , org.ovirt.engine.core.common.queries.GetDbUserByUserIdParameters.class , new java.lang.String [ ] { "UserId" } , new java.lang.Object [ ] { GUIDS [ 1 ] } , getUserByIdx ( 1 ) ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; verifyCollection ( getCollection ( ) ) ; }
Source:
public boolean validateCustomProperties ( java.util.List < java.lang.String > messages ) { org.ovirt.engine.core.common.businessentities.StoragePool dataCenter = getDbFacade ( ) . getStoragePoolDao ( ) . get ( getNetwork ( ) . getDataCenterId ( ) ) ; java.util.List < org.ovirt.engine.core.common.utils.customprop.ValidationError > errors = org.ovirt.engine.core.utils.customprop.DevicePropertiesUtils.getInstance ( ) . validateProperties ( dataCenter.getCompatibilityVersion ( ) , VmDeviceGeneralType.INTERFACE , vnicProfile.getCustomProperties ( ) ) ; if ( ! ( errors.isEmpty ( ) ) ) { org.ovirt.engine.core.utils.customprop.DevicePropertiesUtils.getInstance ( ) . handleCustomPropertiesError ( errors , messages ) ; return false ; } return true ; }

Target:
public boolean validateCustomProperties ( java.util.List < java.lang.String > messages ) { org.ovirt.engine.core.common.businessentities.StoragePool dataCenter = dcDao.get ( getNetwork ( ) . getDataCenterId ( ) ) ; java.util.List < org.ovirt.engine.core.common.utils.customprop.ValidationError > errors = org.ovirt.engine.core.utils.customprop.DevicePropertiesUtils.getInstance ( ) . validateProperties ( dataCenter.getCompatibilityVersion ( ) , VmDeviceGeneralType.INTERFACE , vnicProfile.getCustomProperties ( ) ) ; if ( ! ( errors.isEmpty ( ) ) ) { org.ovirt.engine.core.utils.customprop.DevicePropertiesUtils.getInstance ( ) . handleCustomPropertiesError ( errors , messages ) ; return false ; } return true ; }
Source:
public java.util.Set < java.lang.String > getPeers ( java.lang.String server , java.lang.String password ) throws javax.naming.AuthenticationException { org.ovirt.engine.core.utils.ssh.EngineSSHClient client = null ; try { client = connect ( server ) ; authenticate ( client , org.ovirt.engine.core.utils.gluster.GlusterUtil.USER , password ) ; java.lang.String serversXml = executePeerStatusCommand ( client ) ; return extractServers ( serversXml ) ; } finally { if ( client != null ) { client.disconnect ( ) ; } } }

Target:
public java.util.Set < java.lang.String > getPeers ( java.lang.String server , java.lang.String username , java.lang.String password ) throws javax.naming.AuthenticationException { org.ovirt.engine.core.utils.ssh.SSHClient client = null ; try { client = connect ( server ) ; authenticate ( client , username , password ) ; java.lang.String serversXml = executePeerStatusCommand ( client ) ; return extractServers ( serversXml ) ; } finally { if ( client != null ) { client.disconnect ( ) ; } } }
Source:
public void testIscsiLunCanBeAdded ( ) { org.ovirt.engine.core.common.businessentities.LunDisk disk = org.ovirt.engine.core.bll.AddDiskToVmCommandTest.createISCSILunDisk ( ) ; org.ovirt.engine.core.common.action.AddDiskParameters parameters = org.ovirt.engine.core.bll.AddDiskToVmCommandTest.createParameters ( ) ; parameters.setDiskInfo ( disk ) ; initializeCommand ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , parameters ) ; org.mockito.Mockito.when ( diskLunMapDAO.getDiskIdByLunId ( disk.getLun ( ) . getLUN_id ( ) ) ) . thenReturn ( null ) ; org.junit.Assert.assertTrue ( "checkIfLunDiskCanBeAdded() failed for valid iscsi lun" , command.checkIfLunDiskCanBeAdded ( ) ) ; }

Target:
public void testIscsiLunCanBeAdded ( ) { org.ovirt.engine.core.common.businessentities.LunDisk disk = org.ovirt.engine.core.bll.AddDiskToVmCommandTest.createISCSILunDisk ( ) ; org.ovirt.engine.core.common.action.AddDiskParameters parameters = org.ovirt.engine.core.bll.AddDiskToVmCommandTest.createParameters ( ) ; parameters.setDiskInfo ( disk ) ; initializeCommand ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , parameters ) ; org.mockito.Mockito.when ( diskLunMapDAO.getDiskIdByLunId ( disk.getLun ( ) . getLUN_id ( ) ) ) . thenReturn ( null ) ; org.junit.Assert.assertTrue ( "checkIfLunDiskCanBeAdded() failed for valid iscsi lun" , command.checkIfLunDiskCanBeAdded ( ) ) ; }
Source:
private void markIsSetNonOperationalExecuted ( ) { if ( ! ( _vdsManager.isSetNonOperationalExecuted ( ) ) ) { org.ovirt.engine.core.common.businessentities.VdsDynamic vdsDynamic = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDynamicDAO ( ) . get ( _vds.getId ( ) ) ; if ( ( vdsDynamic.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.NonOperational ) ) { _vdsManager.setIsSetNonOperationalExecuted ( true ) ; } } }

Target:
private void markIsSetNonOperationalExecuted ( ) { if ( ! ( _vdsManager.isSetNonOperationalExecuted ( ) ) ) { org.ovirt.engine.core.common.businessentities.VdsDynamic vdsDynamic = getDbFacade ( ) . getVdsDynamicDAO ( ) . get ( _vds.getId ( ) ) ; if ( ( vdsDynamic.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.NonOperational ) ) { _vdsManager.setIsSetNonOperationalExecuted ( true ) ; } } }
Source:
public void getIsGlusterVolumeSnapshotCliScheduleEnabled ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeSnapshotCliScheduleFlag , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }

Target:
public void getMaxSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery < java.lang.Integer > aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.DefaultValueConverter < > ( 0 ) ; aQuery.getAsyncCallback ( ) . onSuccess ( 10 ) ; }
Source:
protected void separateValidationErrorsList ( java.util.List < org.ovirt.engine.core.utils.customprop.CustomPropertiesUtils.ValidationError > errorsList , java.util.Map < org.ovirt.engine.core.utils.customprop.CustomPropertiesUtils.ValidationFailureReason , java.util.List < org.ovirt.engine.core.utils.customprop.CustomPropertiesUtils.ValidationError > > resultMap ) { if ( ( errorsList == null ) || ( errorsList.isEmpty ( ) ) ) { return ; } for ( org.ovirt.engine.core.utils.customprop.CustomPropertiesUtils.ValidationError error : errorsList ) { org.ovirt.engine.core.utils.collections.MultiValueMapUtils.addToMap ( error.getReason ( ) , error , resultMap ) ; } }

Target:
protected void separateValidationErrorsList ( java.util.List < org.ovirt.engine.core.utils.customprop.ValidationError > errorsList , java.util.Map < org.ovirt.engine.core.utils.customprop.ValidationFailureReason , java.util.List < org.ovirt.engine.core.utils.customprop.ValidationError > > resultMap ) { if ( ( errorsList == null ) || ( errorsList.isEmpty ( ) ) ) { return ; } for ( org.ovirt.engine.core.utils.customprop.ValidationError error : errorsList ) { org.ovirt.engine.core.utils.collections.MultiValueMapUtils.addToMap ( error.getReason ( ) , error , resultMap ) ; } }
Source:
public void testEjectCd ( ) throws java.lang.Exception { setUriInfo ( setUpChangeCdUriMatrixExpectations ( ) ) ; setUpGetEntityExpectations ( 1 , VMStatus.Up ) ; setUpActionExpectations ( VdcActionType.ChangeDisk , org.ovirt.engine.core.common.action.ChangeDiskCommandParameters.class , new java.lang.String [ ] { "CdImagePath" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO } , true , true ) ; org.ovirt.engine.api.model.CdRom update = getUpdate ( ) ; update.getFile ( ) . setId ( org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO ) ; org.ovirt.engine.api.model.CdRom cdrom = resource.update ( update ) ; assertEquals ( org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO , cdrom.getFile ( ) . getId ( ) ) ; }

Target:
public void testEjectCd ( ) throws java.lang.Exception { setUriInfo ( setUpChangeCdUriMatrixExpectations ( ) ) ; setUpGetEntityExpectations ( 1 , VMStatus.Up ) ; setUpActionExpectations ( VdcActionType.ChangeDisk , org.ovirt.engine.core.common.action.ChangeDiskCommandParameters.class , new java.lang.String [ ] { "CdImagePath" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO } , true , true ) ; org.ovirt.engine.api.model.Cdrom update = getUpdate ( ) ; update.getFile ( ) . setId ( org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO ) ; org.ovirt.engine.api.model.Cdrom cdrom = resource.update ( update ) ; assertEquals ( org.ovirt.engine.api.restapi.resource.BackendCdRomResourceTest.EJECT_ISO , cdrom.getFile ( ) . getId ( ) ) ; }
Source:
public boolean handle ( java.util.List < org.ovirt.engine.api.extensions.ExtMap > queryResults ) { boolean result = true ; for ( org.ovirt.engine.api.extensions.ExtMap queryResult : queryResults ) { if ( ( principalRecords.size ( ) ) < ( org.ovirt.engine.core.aaa.AuthzUtils.QUERIES_RESULTS_LIMIT ) ) { principalRecords.add ( queryResult ) ; } else { result = false ; break ; } } return result ; }

Target:
public boolean handle ( java.util.Collection < org.ovirt.engine.api.extensions.ExtMap > queryResults ) { boolean result = true ; for ( org.ovirt.engine.api.extensions.ExtMap queryResult : queryResults ) { if ( ( principalRecords.size ( ) ) < ( org.ovirt.engine.core.aaa.AuthzUtils.QUERIES_RESULTS_LIMIT ) ) { principalRecords.add ( queryResult ) ; } else { result = false ; break ; } } return result ; }
Source:
public void getHostNumaTopologyByHostId ( org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery , org.ovirt.engine.core.compat.Guid hostId ) { asyncQuery.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.VdsNumaNode > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVdsNumaNodesByVdsId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , asyncQuery ) ; }

Target:
public void getVmTemplatesByBaseTemplateId ( org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery , org.ovirt.engine.core.compat.Guid baseTemplate ) { asyncQuery.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.VmTemplate > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmTemplatesByBaseTemplateId , new org.ovirt.engine.core.common.queries.GetVmTemplateParameters ( baseTemplate ) , asyncQuery ) ; }
Source:
public static void getRedirectServletReportsPage ( 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.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.RedirectServletReportsPage , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public static void getNextAvailableDiskAliasNameByVMId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetNextAvailableDiskAliasNameByVMId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
public void canDoActionFailsWithClusterDoesNotSupportGluster ( ) { cmd = org.mockito.Mockito.spy ( createTestCommand ( getVolume ( 2 , false ) ) ) ; prepareMocks ( cmd ) ; org.mockito.Mockito.doReturn ( getVdsGroup ( false ) ) . when ( vdsGroupDao ) . get ( org.mockito.Mockito.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER ) ; }

Target:
public void canDoActionFailsWithClusterDoesNotSupportGluster ( ) { cmd = org.mockito.Mockito.spy ( createTestCommand ( getVolume ( 2 , false ) ) ) ; prepareMocks ( cmd ) ; org.mockito.Mockito.doReturn ( getVdsGroup ( false ) ) . when ( vdsGroupDao ) . get ( org.mockito.Mockito.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( getVdsGroup ( false ) ) . when ( vdsGroupDao ) . getFromCache ( org.mockito.Mockito.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER ) ; }
Source:
public static void isClusterEmpty ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter < java.lang.Boolean > ( ) { @ java.lang.Override public java.lang.Boolean Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return ( ( java.lang.Boolean ) ( source ) ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.IsClusterEmpty , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }

Target:
private void runQueryByIdParameter ( org.ovirt.engine.core.common.queries.VdcQueryType queryType , org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.AsIsAsyncConverter ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( queryType , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }
Source:
public void testGetAllForStoragePoolAndStatus ( ) { org.junit.Assert.assertNotNull ( existingVds.getStatus ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > result = dao.getAllForStoragePoolAndStatus ( existingVds.getStoragePoolId ( ) , existingVds.getStatus ( ) ) ; assertCorrectGetAllResult ( result ) ; }

Target:
public void testGetAllForStoragePoolAndStatuses ( ) { prepareHostWithDifferentStatus ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > result = dao.getAllForStoragePoolAndStatuses ( existingVds.getStoragePoolId ( ) , java.util.EnumSet.of ( existingVds.getStatus ( ) , existingVds2.getStatus ( ) ) ) ; org.junit.Assert.assertTrue ( org.apache.commons.collections.CollectionUtils.disjunction ( result , java.util.Arrays.asList ( existingVds , existingVds2 ) ) . isEmpty ( ) ) ; assertCorrectGetAllResult ( result ) ; }
Source:
protected boolean validate ( org.ovirt.engine.core.bll.ValidationResult validationResult ) { if ( ! ( validationResult.isValid ( ) ) ) { addCanDoActionMessage ( validationResult.getMessage ( ) ) ; for ( java.lang.String variableReplacement : validationResult.getVariableReplacements ( ) ) { addCanDoActionMessage ( variableReplacement ) ; } } return validationResult.isValid ( ) ; }

Target:
protected boolean validate ( org.ovirt.engine.core.bll.ValidationResult validationResult ) { if ( ! ( validationResult.isValid ( ) ) ) { addValidationMessage ( validationResult.getMessage ( ) ) ; for ( java.lang.String variableReplacement : validationResult.getVariableReplacements ( ) ) { addValidationMessage ( variableReplacement ) ; } } return validationResult.isValid ( ) ; }
Source:
public java.lang.Boolean getValue ( ) { for ( org.ovirt.engine.ui.uicommonweb.models.EntityModel model : getNetworksTableItems ( ) ) { org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterNetworkModel clusterNetworkManageModel = ( ( org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterNetworkModel ) ( model ) ) ; if ( canEditAssign ( clusterNetworkManageModel ) ) { if ( ! ( clusterNetworkManageModel.isAttached ( ) ) ) { return false ; } } } return true ; }

Target:
private void changeIsAttached ( org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterNetworkModel clusterNetworkModel , java.lang.Boolean value ) { clusterNetworkModel.setAttached ( value ) ; if ( ( ! value ) && ( clusterNetworkModel.isDisplayNetwork ( ) ) ) { clusterNetworkModel.setDisplayNetwork ( false ) ; } if ( ( ! value ) && ( clusterNetworkModel.isRequired ( ) ) ) { clusterNetworkModel.setRequired ( false ) ; } }
Source:
public void getExternalProviderDiscoveredHostList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.common.businessentities.Provider provider ) { 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.ExternalDiscoveredHost > ( ) ; } return source ; } } ; org.ovirt.engine.core.common.queries.ProviderQueryParameters params = new org.ovirt.engine.core.common.queries.ProviderQueryParameters ( ) ; params.setProvider ( provider ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetDiscoveredHostListFromExternalProvider , params , aQuery ) ; }

Target:
public void getPermittedStorageDomainsByStoragePoolId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId , org.ovirt.engine.core.common.businessentities.ActionGroup actionGroup ) { 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.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters params = new org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters ( ) ; params.setStoragePoolId ( dataCenterId ) ; params.setActionGroup ( actionGroup ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetPermittedStorageDomainsByStoragePoolId , params , aQuery ) ; }
Source:
public double getActualDiskSize ( ) { if ( ( ( actualDiskSize ) == 0 ) && ( ( getDiskImageMap ( ) ) != null ) ) { for ( org.ovirt.engine.core.common.businessentities.Disk disk : getDiskImageMap ( ) . values ( ) ) { if ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) ) { actualDiskSize += ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( disk ) ) . getActualSize ( ) ; } } } return actualDiskSize ; }

Target:
public double getActualDiskSize ( ) { if ( ( ( actualDiskSize ) == 0 ) && ( ( getDiskImageMap ( ) ) != null ) ) { for ( org.ovirt.engine.core.common.businessentities.storage.Disk disk : getDiskImageMap ( ) . values ( ) ) { if ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE ) ) { actualDiskSize += ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( disk ) ) . getActualSize ( ) ; } } } return actualDiskSize ; }
Source:
private void addManagementNetworkToPool ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network ( ) ; network.setName ( org.ovirt.engine.core.common.config.Config.< java.lang.String > getValue ( ConfigValues.DefaultManagementNetwork ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks = new java.util.ArrayList < > ( ) ; networks.add ( network ) ; org.mockito.Mockito.when ( networkDao.getAllForDataCenter ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( networks ) ; }

Target:
private void addNonManagementNetworksToPool ( int numberOfNetwworks ) { for ( int i = 0 ; i < numberOfNetwworks ; i ++ ) { final org.ovirt.engine.core.compat.Guid networkId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.network.Network network = createNetwork ( networkId ) ; network.setId ( networkId ) ; allDcNetworks.add ( network ) ; org.mockito.Mockito.when ( managementNetworkUtil.isManagementNetwork ( networkId ) ) . thenReturn ( false ) ; } org.mockito.Mockito.when ( networkDao.getAllForDataCenter ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( allDcNetworks ) ; }
Source:
org.ovirt.engine.core.dao.network.NetworkDao getNetworkDao ( ) { return networkDao ; }

Target:
protected void executeQueryCommand ( ) { final java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > allDcNetworks = networkDao.getAllForDataCenter ( org.ovirt.engine.core.bll.network.dc.GetManagementNetworkCandidatesQuery.getParameters ( ) . getId ( ) ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > managementNetworkCandidates = allDcNetworks.stream ( ) . filter ( managementNetworkCandidatePredicate ) . collect ( java.util.stream.Collectors.toList ( ) ) ; org.ovirt.engine.core.bll.network.dc.GetManagementNetworkCandidatesQuery.getQueryReturnValue ( ) . setReturnValue ( managementNetworkCandidates ) ; }
Source:
public void executeCommand ( ) { setVolumeId ( volumeId2 ) ; mockBackend ( true , null ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( cmd ) . startSubStep ( ) ; org.mockito.Mockito.verify ( cmd ) . handleTaskReturn ( asyncTaskToBeReturned ) ; org.mockito.Mockito.verify ( cmd ) . updateBricksWithTaskID ( asyncTaskToBeReturned ) ; org.junit.Assert.assertEquals ( AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS , cmd.getAuditLogTypeValue ( ) ) ; }

Target:
public void executeCommand ( ) { setVolumeId ( volumeId2 ) ; mockBackend ( true , null ) ; org.junit.jupiter.api.Assertions.assertTrue ( cmd.validate ( ) ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( cmd ) . startSubStep ( ) ; org.mockito.Mockito.verify ( cmd ) . handleTaskReturn ( asyncTaskToBeReturned ) ; org.mockito.Mockito.verify ( cmd ) . updateBricksWithTaskID ( asyncTaskToBeReturned ) ; org.junit.jupiter.api.Assertions.assertEquals ( AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS , cmd.getAuditLogTypeValue ( ) ) ; }
Source:
public org.ovirt.engine.core.common.action.VdcActionParametersBase getParameters ( org.ovirt.engine.api.model.Cluster incoming , org.ovirt.engine.core.common.businessentities.VDSGroup entity ) { return new org.ovirt.engine.core.common.action.VdsGroupOperationParameters ( map ( incoming , entity ) ) ; }

Target:
public org.ovirt.engine.core.common.action.VdcActionParametersBase getParameters ( org.ovirt.engine.api.model.Cluster incoming , org.ovirt.engine.core.common.businessentities.VDSGroup entity ) { final org.ovirt.engine.core.common.businessentities.VDSGroup cluster = map ( incoming , entity ) ; final org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters managementNetworkOnClusterOperationParameters ; final org.ovirt.engine.core.compat.Guid dcId = getDataCenterId ( cluster ) ; if ( dcId == null ) { managementNetworkOnClusterOperationParameters = new org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters ( cluster ) ; } else { final org.ovirt.engine.core.compat.Guid managementNetworkId = managementNetworkFinder.getManagementNetworkId ( incoming , dcId ) ; managementNetworkOnClusterOperationParameters = new org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters ( cluster , managementNetworkId ) ; } return managementNetworkOnClusterOperationParameters ; }
Source:
public void testValidateWithAttachedStorageDomain ( ) { storageDomain.setStorageType ( StorageType.NFS ) ; storageDomain.setStorageDomainType ( StorageDomainType.Data ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( command ) . isStorageDomainAttached ( storageDomain ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( "validate shouldn't be possible for an attached storage domain" , command , EngineMessage.ACTION_TYPE_FAILED_FORMAT_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN ) ; }

Target:
public void testValidateWithAttachedStorageDomain ( ) { storageDomain.setStorageType ( StorageType.NFS ) ; storageDomain.setStorageDomainType ( StorageDomainType.Data ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( command ) . isStorageDomainAttached ( storageDomain ) ; setVdsStatus ( VDSStatus.Up ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( "validate shouldn't be possible for an attached storage domain" , command , EngineMessage.ACTION_TYPE_FAILED_FORMAT_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN ) ; }
Source:
public void testListCrashClientLocale ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpEntityQueryExpectations ( 1 , t ) ; collection.setUriInfo ( uriInfo ) ; try { getCollection ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; } }

Target:
public void testListCrashClientLocale ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpEntityQueryExpectations ( 1 , t ) ; collection.setUriInfo ( uriInfo ) ; verifyFault ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , this :: getCollection ) , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; }
Source:
public void testListCrashClientLocale ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpEntityQueryExpectations ( 1 , t ) ; control.replay ( ) ; collection.setUriInfo ( uriInfo ) ; try { getCollection ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; } finally { locales.clear ( ) ; } }

Target:
protected void verifyModel ( org.ovirt.engine.api.model.Disk model , int index ) { org.ovirt.engine.api.restapi.resource.BackendTemplateDisksResourceTest.verifyModelSpecific ( model , index ) ; verifyLinks ( model ) ; }
Source:
protected org.ovirt.engine.core.compat.Guid getClusterId ( org.ovirt.engine.api.model.Template template ) { return getEntity ( org.ovirt.engine.core.common.businessentities.VDSGroup.class , SearchType.Cluster , ( "Cluster: name=" + ( template.getCluster ( ) . getName ( ) ) ) ) . getId ( ) ; }

Target:
protected org.ovirt.engine.core.compat.Guid getClusterId ( org.ovirt.engine.api.model.Template template ) { return getEntity ( org.ovirt.engine.core.common.businessentities.VDSGroup.class , VdcQueryType.GetVdsGroupByName , new org.ovirt.engine.core.common.queries.NameQueryParameters ( template.getCluster ( ) . getName ( ) ) , ( "Cluster: name=" + ( template.getCluster ( ) . getName ( ) ) ) ) . getId ( ) ; }
Source:
private void localize ( ) { vcpuExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; vcpuExpander.setTitleWhenExpended ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; memoryExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; memoryExpander.setTitleWhenExpended ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; storageExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; storageExpander.setTitleWhenExpended ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; }

Target:
private void localize ( ) { vcpuExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; vcpuExpander.setTitleWhenExpanded ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; memoryExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; memoryExpander.setTitleWhenExpanded ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; storageExpander.setTitleWhenCollapsed ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.showQuotaDistribution ( ) ) ; storageExpander.setTitleWhenExpanded ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.SideTabExtendedResourceView.constants.hideQuotaDistribution ( ) ) ; }
Source:
private java.util.List < java.lang.String > findViolatedNics ( java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypesMap ) { java.util.List < java.lang.String > violatedNics = new java.util.ArrayList < > ( ) ; for ( java.util.Map.Entry < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypes : nicNameToNetworkTypesMap.entrySet ( ) ) { java.lang.String nicName = nicNameToNetworkTypes.getKey ( ) ; java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > networkTypes = nicNameToNetworkTypes.getValue ( ) ; if ( ! ( validateNetworkTypesOnNic ( networkTypes ) ) ) { violatedNics.add ( nicName ) ; } } return violatedNics ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult validateNetworkExclusiveOnNics ( ) { java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.network.NetworkType > > nicNameToNetworkTypesMap = createNicNameToNetworkTypesMap ( ) ; java.util.List < java.lang.String > violatedNics = findViolatedNics ( nicNameToNetworkTypesMap ) ; if ( violatedNics.isEmpty ( ) ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } else { final org.ovirt.engine.core.common.errors.EngineMessage violationMessage = networkExclusivenessValidator.getViolationMessage ( ) ; return new org.ovirt.engine.core.bll.ValidationResult ( violationMessage , org.ovirt.engine.core.utils.ReplacementUtils.replaceWith ( ( violationMessage + ( org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.LIST_SUFFIX ) ) , violatedNics ) ) ; } }
Source:
public void endSuccessfully ( ) { updateDestinitationImageId ( ) ; endCreateAllSnapshots ( ) ; org.ovirt.engine.core.bll.ImagesHandler.updateImageStatus ( enclosingCommand.getParameters ( ) . getDestinationImageId ( ) , ImageStatus.LOCKED ) ; }

Target:
public void endSuccessfully ( ) { endCreateAllSnapshots ( ) ; for ( org.ovirt.engine.core.common.action.LiveMigrateDiskParameters parameters : enclosingCommand.getParameters ( ) . getParametersList ( ) ) { updateDestinationImageId ( parameters ) ; org.ovirt.engine.core.bll.ImagesHandler.updateImageStatus ( parameters.getDestinationImageId ( ) , ImageStatus.LOCKED ) ; } org.ovirt.engine.core.bll.job.ExecutionHandler.endJob ( enclosingCommand.getExecutionContext ( ) , true ) ; enclosingCommand.setExecutionContext ( null ) ; }
Source:
public void getHostFingerprint ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String hostAddress ) { 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.GetServerSSHKeyFingerprint , new org.ovirt.engine.core.common.queries.ServerParameters ( hostAddress ) , aQuery ) ; }

Target:
public void getRoleActionGroupsByRoleId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid roleId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetRoleActionGroupsByRoleId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( roleId ) , aQuery ) ; }
Source:
public static int parseUnsignedShort ( java.lang.String value ) { java.math.BigInteger result = javax.xml.bind.DatatypeConverter.parseInteger ( value ) ; if ( ( result.compareTo ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_SHORT ) ) > 0 ) { throw new org.ovirt.engine.api.utils.InvalidValueException ( ( ( ( "Value " + value ) + " is greater than maximum unsigned short " ) + ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_SHORT ) ) ) ; } return result.intValue ( ) ; }

Target:
public static int parseUnsignedShort ( java.lang.String value ) { if ( value.trim ( ) . equals ( "" ) ) { value = "0" ; } java.math.BigInteger result = javax.xml.bind.DatatypeConverter.parseInteger ( value ) ; if ( ( result.compareTo ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_SHORT ) ) > 0 ) { throw new org.ovirt.engine.api.utils.InvalidValueException ( ( ( ( "Value " + value ) + " is greater than maximum unsigned short " ) + ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_SHORT ) ) ) ; } return result.intValue ( ) ; }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( "OnSave" . equals ( command.getName ( ) ) ) { onSave ( ) ; } else if ( "Cancel" . equals ( command.getName ( ) ) ) { cancel ( ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceModel.ON_SAVE_COMMAND.equals ( command.getName ( ) ) ) { onSave ( ) ; } else if ( org.ovirt.engine.ui.uicommonweb.models.vms.CANCEL_COMMAND.equals ( command.getName ( ) ) ) { cancel ( ) ; } }
Source:
public void testParseMultiple ( ) { java.util.List < org.ovirt.engine.api.model.Agent > ret = org.ovirt.engine.api.restapi.util.FenceOptionsParser.parse ( "foo:one=1,two=2,three=3;bar:ninetynine=99" , "one=bool,two=int,three=bool,ninetynine=int" ) ; assertNotNull ( ret ) ; assertEquals ( 2 , ret.size ( ) ) ; verifyResult ( ret.get ( 0 ) , "foo" , "one" , "bool" , "1" , "two" , "int" , "2" , "three" , "bool" , "3" ) ; verifyResult ( ret.get ( 1 ) , "bar" , "ninetynine" , "int" , "99" ) ; }

Target:
public void testParseMultiple ( ) { java.util.List < org.ovirt.engine.api.model.Agent > ret = org.ovirt.engine.api.restapi.util.FenceOptionsParser.parse ( "foo:one=1,two=2,three=3;bar:ninetynine=99" , "one=bool,two=int,three=bool,ninetynine=int" ) ; org.junit.Assert.assertNotNull ( ret ) ; org.junit.Assert.assertEquals ( 2 , ret.size ( ) ) ; verifyResult ( ret.get ( 0 ) , "foo" , "one" , "bool" , "1" , "two" , "int" , "2" , "three" , "bool" , "3" ) ; verifyResult ( ret.get ( 1 ) , "bar" , "ninetynine" , "int" , "99" ) ; }
Source:
private void mockBackend ( ) { org.mockito.Mockito.when ( backend.getResourceManager ( ) ) . thenReturn ( vdsBrokerFrontend ) ; org.mockito.Mockito.doReturn ( backend ) . when ( command ) . getBackend ( ) ; }

Target:
private void initCommand ( ) { org.ovirt.engine.core.common.action.FenceVdsActionParameters params = new org.ovirt.engine.core.common.action.FenceVdsActionParameters ( ) ; params.setVdsId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ; command = new org.ovirt.engine.core.bll.pm.StartVdsCommand ( params ) ; command.setAuditLogDirector ( auditLogDirector ) ; command = org.mockito.Mockito.spy ( command ) ; org.mockito.Mockito.doReturn ( executor ) . when ( command ) . createHostFenceActionExecutor ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VDS.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.FencingPolicy.class ) ) ; org.mockito.Mockito.doReturn ( vdsBrokerFrontend ) . when ( command ) . getVdsBroker ( ) ; command.setVdsGroupId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_CLUSTER_ID ) ; }
Source:
public void enableLoadBalancer ( ) { if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.EnableVdsLoadBalancing ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Start scheduling to enable vds load balancer" ) ; org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl.getInstance ( ) . scheduleAFixedDelayJob ( this , "performLoadBalancing" , new java.lang.Class [ ] { } , new java.lang.Object [ ] { } , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsLoadBalancingIntervalInMinutes ) , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsLoadBalancingIntervalInMinutes ) , java.util.concurrent.TimeUnit.MINUTES ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Finished scheduling to enable vds load balancer" ) ; } }

Target:
public void enableLoadBalancer ( ) { if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.EnableVdsLoadBalancing ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Start scheduling to enable vds load balancer" ) ; org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl.class ) . scheduleAFixedDelayJob ( this , "performLoadBalancing" , new java.lang.Class [ ] { } , new java.lang.Object [ ] { } , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsLoadBalancingIntervalInMinutes ) , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.VdsLoadBalancingIntervalInMinutes ) , java.util.concurrent.TimeUnit.MINUTES ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Finished scheduling to enable vds load balancer" ) ; } }
Source:
public void testUpdateLUNsVolumeGroupId ( ) { java.lang.String testGroupId = "testvolgroupId" ; dao.updateLUNsVolumeGroupId ( existingLUN.getLUN_id ( ) , testGroupId ) ; org.ovirt.engine.core.common.businessentities.LUNs dbLun = dao.get ( existingLUN.getLUN_id ( ) ) ; org.junit.Assert.assertEquals ( "LUNs volume group id wasn't updated" , testGroupId , dbLun.getvolume_group_id ( ) ) ; }

Target:
public void testUpdateLUNs ( ) { dao.update ( existingLUN ) ; org.ovirt.engine.core.common.businessentities.LUNs result = dao.get ( existingLUN.getLUN_id ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( existingLUN , result ) ; }
Source:
private void updateVolumeFormat ( org.ovirt.engine.core.common.businessentities.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { setVolumeFormat ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDiskVolumeFormat ( volumeType , storageType ) ) ; }

Target:
private void updateShareableDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { boolean isShareableDiskEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.ShareableDiskEnabled , datacenter.getcompatibility_version ( ) . getValue ( ) ) ) ) ; if ( getIsShareable ( ) . getIsChangable ( ) ) { getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.shareableDiskNotSupported ( ) ) ; getIsShareable ( ) . setIsChangable ( ( isShareableDiskEnabled && ( isEditEnabled ( ) ) ) ) ; } }
Source:
public boolean eval ( org.ovirt.engine.core.common.businessentities.VDS p ) { return ( ( ( p.getUsageCpuPercent ( ) ) <= lowUtilization ) && ( ( p.getCpuOverCommitTimestamp ( ) ) != null ) ) && ( ( ( new java.util.Date ( ) . getTime ( ) ) - ( p.getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) >= ( ( cpuOverCommitDurationMinutes * 60L ) * 1000L ) ) ; }

Target:
public boolean eval ( org.ovirt.engine.core.common.businessentities.VDS p ) { return ( ( ( ( p.getUsageCpuPercent ( ) ) <= lowUtilization ) && ( ( p.getCpuOverCommitTimestamp ( ) ) != null ) ) && ( ( ( new java.util.Date ( ) . getTime ( ) ) - ( p.getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) >= ( ( cpuOverCommitDurationMinutes * 60L ) * 1000L ) ) ) && ( ( p.getVmCount ( ) ) > 0 ) ; }