auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 2 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Vm model = org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }

Target:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 2 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Vm model = org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }
Source:
protected void setUpGetNetworksByDataCenterExpectations ( int times , java.lang.Object failure ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpEntityQueryExpectations ( VdcQueryType.GetAllNetworks , org.ovirt.engine.core.common.queries.GetAllNetworkQueryParamenters.class , new java.lang.String [ ] { "StoragePoolId" } , new java.lang.Object [ ] { GUIDS [ 2 ] } , getEntityList ( ) , failure ) ; } }

Target:
protected void setUpGetNetworksByDataCenterExpectations ( int times , java.lang.Object failure ) throws java.lang.Exception { while ( ( times -- ) > 0 ) { setUpEntityQueryExpectations ( VdcQueryType.GetAllNetworks , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 2 ] } , getEntityList ( ) , failure ) ; } }
Source:
private java.lang.String getVmPoolIsBeingUpdatedMessage ( ) { java.lang.StringBuilder builder = new java.lang.StringBuilder ( EngineMessage.ACTION_TYPE_FAILED_VM_POOL_IS_BEING_UPDATED.name ( ) ) ; if ( ( org.ovirt.engine.core.bll.UpdateVmPoolCommand.getVmPool ( ) ) != null ) { builder.append ( java.lang.String.format ( "$VmPoolName %1$s" , org.ovirt.engine.core.bll.UpdateVmPoolCommand.getVmPool ( ) . getName ( ) ) ) ; } return builder.toString ( ) ; }

Target:
protected java.util.Map < java.lang.String , org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.lang.String > > getExclusiveLocks ( ) { return java.util.Collections.singletonMap ( org.ovirt.engine.core.bll.UpdateVmPoolCommand.getVmPoolId ( ) . toString ( ) , org.ovirt.engine.core.bll.LockMessagesMatchUtil.makeLockingPair ( LockingGroup.VM_POOL , new org.ovirt.engine.core.bll.LockMessage ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_POOL_IS_BEING_UPDATED ) . withOptional ( "VmPoolName" , ( ( org.ovirt.engine.core.bll.UpdateVmPoolCommand.getVmPool ( ) ) != null ? org.ovirt.engine.core.bll.UpdateVmPoolCommand.getVmPool ( ) . getName ( ) : null ) ) ) ) ; }
Source:
public void edit ( ) { T qos = ( ( T ) ( org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterQosListModel.getSelectedItem ( ) ) ) ; if ( ( org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterQosListModel.getWindow ( ) ) != null ) { return ; } final org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.EditQosModel < T , P > qosModel = getEditQosModel ( qos ) ; setWindow ( qosModel ) ; qosModel.getDataCenters ( ) . setItems ( java.util.Arrays.asList ( getEntity ( ) ) , getEntity ( ) ) ; }

Target:
protected void onSelectedItemChanged ( ) { super . onSelectedItemChanged ( ) ; updateActionAvailability ( ) ; }
Source:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { super . onLogin ( loginModel ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { commonModelProvider.get ( ) . updateReportsAvailability ( ) ; } } ) ; performLogin ( loginModel ) ; }

Target:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { super . onLogin ( loginModel ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { commonModelProvider.get ( ) . updateReportsAvailability ( ) ; } } ) ; performLogin ( loginModel ) ; displayBrowserCompatibilityWarning ( ) ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getNetworkClusterDAO ( ) . remove ( org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getVdsGroupId ( ) , org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) . getId ( ) ) ; org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.setSucceeded ( true ) ; }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void runInTransaction ( ) { getNetworkClusterDAO ( ) . remove ( getParameters ( ) . getVdsGroupId ( ) , getParameters ( ) . getNetwork ( ) . getId ( ) ) ; return null ; } } ) ; org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.setSucceeded ( true ) ; }
Source:
void setupCloneTemplatePermissions ( org.ovirt.engine.api.model.VM vm , org.ovirt.engine.core.common.action.VmManagementParametersBase params ) { if ( ( vm.isSetPermissions ( ) ) && ( vm.getPermissions ( ) . isSetClone ( ) ) ) { params.setCopyTemplatePermissions ( vm.getPermissions ( ) . isClone ( ) ) ; } }

Target:
void setupCloneTemplatePermissions ( org.ovirt.engine.api.model.Vm vm , org.ovirt.engine.core.common.action.VmManagementParametersBase params ) { if ( ( vm.isSetPermissions ( ) ) && ( vm.getPermissions ( ) . isSetClone ( ) ) ) { params.setCopyTemplatePermissions ( vm.getPermissions ( ) . isClone ( ) ) ; } }
Source:
public void testGet ( ) { resource.getParent ( ) . setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 ) ; org.ovirt.engine.api.model.ReportedDevice device = resource.get ( ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.api.restapi.resource.BackendVmReportedDeviceResourceTest.DEVICE_ID.toString ( ) , device.getId ( ) ) ; verifyLinks ( device ) ; }

Target:
public void testGet ( ) { resource.getParent ( ) . setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 ) ; org.ovirt.engine.api.model.ReportedDevice device = resource.get ( ) ; org.junit.jupiter.api.Assertions.assertEquals ( org.ovirt.engine.api.restapi.resource.BackendVmReportedDeviceResourceTest.DEVICE_ID.toString ( ) , device.getId ( ) ) ; verifyLinks ( device ) ; }
Source:
private void SaveSanStorage ( ) { if ( ( getWindow ( ) . getProgress ( ) ) != null ) { return ; } getWindow ( ) . StartProgress ( null ) ; org.ovirt.engine.ui.uicompat.Task.Create ( this , new java.util.ArrayList < java.lang.Object > ( java.util.Arrays.asList ( new java.lang.Object [ ] { "SaveSan" } ) ) ) . Run ( ) ; }

Target:
private void SaveSanStorage ( ) { org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel storageModel = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel ) ( getWindow ( ) ) ) ; org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModel sanStorageModel = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModel ) ( storageModel.getSelectedItem ( ) ) ) ; java.util.ArrayList < java.lang.String > usedLunsMessages = sanStorageModel.getUsedLunsMessages ( ) ; if ( usedLunsMessages.isEmpty ( ) ) { OnSaveSanStorage ( ) ; } else { ForceCreationWarning ( usedLunsMessages ) ; } }
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS host = org.ovirt.engine.core.bll.GetHostArchitectureQuery.getDbFacade ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetHostArchitectureQuery.getParameters ( ) . getId ( ) ) ; org.ovirt.engine.core.common.businessentities.ServerCpu sc = org.ovirt.engine.core.bll.CpuFlagsManagerHandler.findMaxServerCpuByFlags ( host.getCpuFlags ( ) , host.getVdsGroupCompatibilityVersion ( ) ) ; org.ovirt.engine.core.bll.GetHostArchitectureQuery.getQueryReturnValue ( ) . setReturnValue ( ( sc == null ? org.ovirt.engine.core.common.businessentities.ArchitectureType.undefined : sc.getArchitecture ( ) ) ) ; }

Target:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS host = org.ovirt.engine.core.bll.GetHostArchitectureQuery.getDbFacade ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetHostArchitectureQuery.getParameters ( ) . getId ( ) ) ; org.ovirt.engine.core.common.businessentities.ServerCpu sc = org.ovirt.engine.core.bll.GetHostArchitectureQuery.getCpuFlagsManagerHandler ( ) . findMaxServerCpuByFlags ( host.getCpuFlags ( ) , host.getVdsGroupCompatibilityVersion ( ) ) ; org.ovirt.engine.core.bll.GetHostArchitectureQuery.getQueryReturnValue ( ) . setReturnValue ( ( sc == null ? org.ovirt.engine.core.common.businessentities.ArchitectureType.undefined : sc.getArchitecture ( ) ) ) ; }
Source:
public void testUpdateHotPlugDisk ( ) { org.ovirt.engine.core.common.businessentities.VmDevice vmDevice = dao.get ( getExistingEntityId ( ) ) ; boolean newPluggedValue = ! ( vmDevice.isPlugged ( ) ) ; org.junit.Assert.assertTrue ( org.apache.commons.lang.StringUtils.isNotBlank ( vmDevice.getAddress ( ) ) ) ; vmDevice.setPlugged ( newPluggedValue ) ; dao.updateHotPlugDisk ( vmDevice ) ; dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertEquals ( vmDevice.isPlugged ( ) , newPluggedValue ) ; }

Target:
public void testUpdateHotPlugDisk ( ) { org.ovirt.engine.core.common.businessentities.VmDevice vmDevice = dao.get ( getExistingEntityId ( ) ) ; boolean newPluggedValue = ! ( vmDevice.isPlugged ( ) ) ; org.junit.jupiter.api.Assertions.assertTrue ( org.apache.commons.lang.StringUtils.isNotBlank ( vmDevice.getAddress ( ) ) ) ; vmDevice.setPlugged ( newPluggedValue ) ; dao.updateHotPlugDisk ( vmDevice ) ; dao.get ( getExistingEntityId ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( vmDevice.isPlugged ( ) , newPluggedValue ) ; }
Source:
public static void getGlusterHostsNewlyAdded ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId , boolean isFingerprintRequired ) { 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.GetAddedGlusterServers , new org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters ( clusterId , isFingerprintRequired ) , aQuery ) ; }

Target:
public void getTemplateById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid templateId ) { 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.GetVmTemplate , new org.ovirt.engine.core.common.queries.GetVmTemplateParameters ( templateId ) , aQuery ) ; }
Source:
private java.lang.Integer getPmPrimaryPortAsInteger ( ) { if ( ( ( getPmPort ( ) ) != null ) && ( ( getPmPort ( ) . getEntity ( ) ) != null ) ) { return java.lang.Integer.valueOf ( getPmPort ( ) . getEntity ( ) ) ; } else { return null ; } }

Target:
private org.ovirt.engine.core.common.utils.CpuVendor getCurrentCpuVendor ( ) { if ( ( getCluster ( ) . getSelectedItem ( ) ) == null ) { return null ; } final org.ovirt.engine.core.common.businessentities.Cluster selectedCluster = getCluster ( ) . getSelectedItem ( ) ; final org.ovirt.engine.core.common.businessentities.ServerCpu clustersCpu = org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getCpuByName ( selectedCluster.getCpuName ( ) , selectedCluster.getCompatibilityVersion ( ) ) ; if ( clustersCpu == null ) { return null ; } return clustersCpu.getVendor ( ) ; }
Source:
public static org.ovirt.engine.core.bll.ValidationResult isCinderHasNoImages ( org.ovirt.engine.core.compat.Guid storageDomainId ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > cinderDisks = org.ovirt.engine.core.bll.storage.CINDERStorageHelper.getDbFacade ( ) . getDiskImageDao ( ) . getAllForStorageDomain ( storageDomainId ) ; if ( ! ( cinderDisks.isEmpty ( ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ERROR_CANNOT_DETACH_CINDER_PROVIDER_WITH_IMAGES ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public static org.ovirt.engine.core.bll.ValidationResult isCinderHasNoImages ( org.ovirt.engine.core.compat.Guid storageDomainId ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > cinderDisks = org.ovirt.engine.core.bll.storage.CINDERStorageHelper.getDbFacade ( ) . getDiskImageDao ( ) . getAllForStorageDomain ( storageDomainId ) ; if ( ! ( cinderDisks.isEmpty ( ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ERROR_CANNOT_DETACH_CINDER_PROVIDER_WITH_IMAGES ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private boolean networkExists ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.NetworkCluster > networks = org.ovirt.engine.core.bll.network.cluster.AttachNetworkToVdsGroupCommand.getNetworkClusterDAO ( ) . getAllForCluster ( org.ovirt.engine.core.bll.network.cluster.AttachNetworkToVdsGroupCommand.getVdsGroupId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster networkCluster : networks ) { if ( networkCluster.getNetworkId ( ) . equals ( getNetworkCluster ( ) . getNetworkId ( ) ) ) { return true ; } } return false ; }

Target:
private static boolean networkExists ( org.ovirt.engine.core.compat.Guid clusterId , org.ovirt.engine.core.common.businessentities.network.NetworkCluster networkCluster ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.NetworkCluster > networks = org.ovirt.engine.core.bll.network.cluster.AttachNetworkToVdsGroupCommand.getNetworkClusterDao ( ) . getAllForCluster ( clusterId ) ; for ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster nc : networks ) { if ( nc.getNetworkId ( ) . equals ( networkCluster.getNetworkId ( ) ) ) { return true ; } } return false ; }
Source:
public void getGlusterHookContent ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hookId , org.ovirt.engine.core.compat.Guid serverId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : "" ; } } ; org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters parameters = new org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters ( hookId ) ; parameters.setGlusterServerId ( serverId ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterHookContent , parameters , aQuery ) ; }

Target:
public void getGlusterHook ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hookId , boolean includeServerHooks ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterHookById , new org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters ( hookId , includeServerHooks ) , aQuery ) ; }
Source:
public static org.ovirt.engine.core.common.businessentities.StorageFormatType map ( org.ovirt.engine.api.restapi.model.StorageFormat model , org.ovirt.engine.core.common.businessentities.StorageFormatType template ) { if ( model == null ) { return null ; } switch ( model ) { case V1 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V1 ; case V2 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V2 ; case V3 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V3 ; default : assert false : "unknown storage-format value: " + ( model.toString ( ) ) ; return null ; } }

Target:
public static org.ovirt.engine.core.common.businessentities.StorageFormatType map ( org.ovirt.engine.api.model.StorageFormat model , org.ovirt.engine.core.common.businessentities.StorageFormatType template ) { if ( model == null ) { return null ; } switch ( model ) { case V1 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V1 ; case V2 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V2 ; case V3 : return org.ovirt.engine.core.common.businessentities.StorageFormatType.V3 ; default : assert false : "unknown storage-format value: " + ( model.toString ( ) ) ; return null ; } }
Source:
public void testLogMtuDiffs ( ) { for ( org.ovirt.engine.core.common.businessentities.VdsNetworkInterface iface : org.ovirt.engine.core.vdsbroker.vdsbroker.VdsUpdateRunTimeInfoTest.getInterfaces ( ) ) { updater.logMTUDifferences ( org.ovirt.engine.core.vdsbroker.vdsbroker.VdsUpdateRunTimeInfoTest.getClustersMap ( ) , iface ) ; } junit.framework.Assert.assertEquals ( 1 , mockAuditLogDao.getAll ( ) . size ( ) ) ; }

Target:
public void testLogMtuDiffs ( ) { for ( org.ovirt.engine.core.common.businessentities.VdsNetworkInterface iface : org.ovirt.engine.core.vdsbroker.VdsUpdateRunTimeInfoTest.getInterfaces ( ) ) { updater.logMTUDifferences ( org.ovirt.engine.core.vdsbroker.VdsUpdateRunTimeInfoTest.getClustersMap ( ) , iface ) ; } junit.framework.Assert.assertEquals ( 1 , mockAuditLogDao.getAll ( ) . size ( ) ) ; }
Source:
public boolean isCacheUpdateNeeded ( ) { int quotaCount = getQuotaDAO ( ) . getQuotaCount ( ) ; int cacheCount = 0 ; lock.readLock ( ) . lock ( ) ; try { for ( java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.Quota > quotaMap : storagePoolQuotaMap.values ( ) ) { cacheCount += quotaMap.size ( ) ; } } finally { lock.readLock ( ) . unlock ( ) ; } return cacheCount < ( ( quotaCount * ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.MinimumPercentageToUpdateQuotaCache ) ) ) / 100 ) ; }

Target:
public boolean isCacheUpdateNeeded ( ) { int quotaCount = getQuotaDao ( ) . getQuotaCount ( ) ; int cacheCount = 0 ; lock.readLock ( ) . lock ( ) ; try { for ( java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.Quota > quotaMap : storagePoolQuotaMap.values ( ) ) { cacheCount += quotaMap.size ( ) ; } } finally { lock.readLock ( ) . unlock ( ) ; } return cacheCount < ( ( quotaCount * ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.MinimumPercentageToUpdateQuotaCache ) ) ) / 100 ) ; }
Source:
protected final boolean failCanDoAction ( org.ovirt.engine.core.dal.VdcBllMessages message ) { addCanDoActionMessage ( message ) ; return false ; }

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.error ( "RollbackQuota: failed (may be because quota is disabled)" , e ) ; } cancelTasks ( ) ; }
Source:
public void checkRemoveNFSConnectionNoDomain ( ) { parameters.setStorageServerConnection ( NFSConnection ) ; org.mockito.Mockito.when ( storageServerConnectionDao.get ( NFSConnection.getId ( ) ) ) . thenReturn ( NFSConnection ) ; java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > domains = new java.util.ArrayList < > ( ) ; org.mockito.Mockito.doReturn ( domains ) . when ( command ) . getStorageDomainsByConnId ( NFSConnection.getId ( ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( command ) ; }

Target:
public void checkRemoveNFSConnectionNoDomain ( ) { parameters.setStorageServerConnection ( NFSConnection ) ; org.mockito.Mockito.when ( storageServerConnectionDao.get ( NFSConnection.getId ( ) ) ) . thenReturn ( NFSConnection ) ; java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > domains = new java.util.ArrayList < > ( ) ; org.mockito.Mockito.doReturn ( domains ) . when ( command ) . getStorageDomainsByConnId ( NFSConnection.getId ( ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }
Source:
private void testAddInvalidSDStatusMessage ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus status ) { cmd.addInvalidSDStatusMessage ( status ) ; java.util.List < java.lang.String > messages = cmd.getReturnValue ( ) . getCanDoActionMessages ( ) ; org.junit.Assert.assertEquals ( messages.get ( 0 ) , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2.toString ( ) ) ; org.junit.Assert.assertEquals ( messages.get ( 1 ) , java.lang.String.format ( "$status %1$s" , status ) ) ; }

Target:
private void validateCanDoActionDomainInProcess ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus masterStatus , org.ovirt.engine.core.common.businessentities.StorageDomainStatus regularStatus , org.ovirt.engine.core.common.businessentities.StorageDomainStatus expectedStatus ) { masterDomainIsoMap.setStatus ( masterStatus ) ; regularDomainIsoMap.setStatus ( regularStatus ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2 ) ; java.util.List < java.lang.String > messages = cmd.getReturnValue ( ) . getCanDoActionMessages ( ) ; org.junit.Assert.assertEquals ( messages.get ( 0 ) , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2.toString ( ) ) ; org.junit.Assert.assertEquals ( messages.get ( 1 ) , java.lang.String.format ( "$status %1$s" , expectedStatus ) ) ; }
Source:
public void formatValue ( java.lang.String fieldName , org.ovirt.engine.core.compat.RefObject < java.lang.String > relations , org.ovirt.engine.core.compat.RefObject < java.lang.String > value , boolean caseSensitive ) { if ( "CREATIONDATE" . equals ( fieldName ) ) { java.util.Date tmp = new java.util.Date ( java.util.Date.parse ( org.ovirt.engine.core.compat.StringHelper.trim ( value.argvalue , '\'' ) ) ) ; value.argvalue = org.ovirt.engine.core.compat.StringFormat.format ( "'%1$s'" , tmp ) ; } else { super . formatValue ( fieldName , relations , value , caseSensitive ) ; } }

Target:
public void formatValue ( java.lang.String fieldName , org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.lang.String > pair , boolean caseSensitive ) { if ( "CREATIONDATE" . equals ( fieldName ) ) { java.util.Date tmp = new java.util.Date ( java.util.Date.parse ( org.ovirt.engine.core.compat.StringHelper.trim ( pair.getSecond ( ) , '\'' ) ) ) ; pair.setSecond ( org.ovirt.engine.core.compat.StringFormat.format ( "'%1$s'" , tmp ) ) ; } else { super . formatValue ( fieldName , pair , caseSensitive ) ; } }
Source:
protected void beforeCommandExecuted ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . beforeCommandExecuted ( command ) ; if ( command == ( model.getDefaultCommand ( ) ) ) { removeListeners ( model ) ; getView ( ) . flushToPrivateModel ( ) ; consoleOptionsPersister.storeToLocalStorage ( model.getModel ( ) ) ; org.ovirt.engine.ui.common.presenter.popup.ConsoleModelChangedEvent.fire ( this , model.getModel ( ) ) ; } }

Target:
protected void beforeCommandExecuted ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . beforeCommandExecuted ( command ) ; if ( command == ( model.getDefaultCommand ( ) ) ) { removeListeners ( model ) ; getView ( ) . flushToPrivateModel ( ) ; consoleOptionsPersister.storeToLocalStorage ( model.getVmConsoles ( ) ) ; org.ovirt.engine.ui.common.presenter.popup.ConsoleModelChangedEvent.fire ( this ) ; } }
Source:
public void testGet ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.StorageConnectionExtension extension = resource.get ( ) ; assertNotNull ( extension ) ; assertEquals ( extension.getId ( ) , org.ovirt.engine.api.restapi.resource.BackendStorageServerConnectionExtensionResourceTest.extensionID.toString ( ) ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.StorageConnectionExtension extension = resource.get ( ) ; org.junit.Assert.assertNotNull ( extension ) ; org.junit.Assert.assertEquals ( extension.getId ( ) , org.ovirt.engine.api.restapi.resource.BackendStorageServerConnectionExtensionResourceTest.extensionID.toString ( ) ) ; }
Source:
public void Template_SelectedItemChanged ( ) { super . Template_SelectedItemChanged ( ) ; getModel ( ) . getName ( ) . setEntity ( "" ) ; getModel ( ) . getDescription ( ) . setEntity ( "" ) ; getModel ( ) . getProvisioning ( ) . setEntity ( true ) ; getModel ( ) . getProvisioning ( ) . setIsAvailable ( true ) ; getModel ( ) . getProvisioning ( ) . setIsChangable ( false ) ; InitDisks ( ) ; InitStorageDomains ( ) ; }

Target:
public void template_SelectedItemChanged ( ) { super . template_SelectedItemChanged ( ) ; getModel ( ) . getName ( ) . setEntity ( "" ) ; getModel ( ) . getDescription ( ) . setEntity ( "" ) ; getModel ( ) . getProvisioning ( ) . setEntity ( true ) ; getModel ( ) . getProvisioning ( ) . setIsAvailable ( true ) ; getModel ( ) . getProvisioning ( ) . setIsChangable ( false ) ; initDisks ( ) ; initStorageDomains ( ) ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult isDomainHasNoImages ( org.ovirt.engine.core.common.errors.VdcBllMessages message , boolean allowOvfDisk ) { int numOfAllowedDisks = 0 ; if ( allowOvfDisk ) { numOfAllowedDisks = getDbFacade ( ) . getStorageDomainOvfInfoDao ( ) . getAllForDomain ( storageDomain.getId ( ) ) . size ( ) ; } if ( ( getDbFacade ( ) . getDiskImageDao ( ) . getAllSnapshotsForStorageDomain ( storageDomain.getId ( ) ) . size ( ) ) > numOfAllowedDisks ) { return new org.ovirt.engine.core.bll.ValidationResult ( message ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult hasSpaceForAllDisks ( java.util.Collection < org.ovirt.engine.core.common.businessentities.DiskImage > newDiskImages , java.util.Collection < org.ovirt.engine.core.common.businessentities.DiskImage > clonedDiskImages ) { double availableSize = storageDomain.getAvailableDiskSizeInBytes ( ) ; double totalSizeForNewDisks = getTotalSizeForNewDisks ( newDiskImages ) ; double totalSizeForClonedDisks = getTotalSizeForClonedDisks ( clonedDiskImages ) ; double totalSizeForDisks = totalSizeForNewDisks + totalSizeForClonedDisks ; return validateRequiredSpace ( availableSize , totalSizeForDisks ) ; }
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = getDbFacade ( ) . getDiskDao ( ) . get ( getParameters ( ) . getObjectId ( ) ) ; if ( disk == null ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST ) ; return false ; } if ( ! ( disk.getDiskStorageType ( ) . isInternal ( ) ) ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_DISK_OPERATION ) ; return false ; } this . disk = ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( disk ) ) ; return super . canDoAction ( ) ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = getDbFacade ( ) . getDiskDao ( ) . get ( getParameters ( ) . getObjectId ( ) ) ; if ( disk == null ) { addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_EXIST ) ; return false ; } if ( ! ( disk.getDiskStorageType ( ) . isInternal ( ) ) ) { addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_ILLEGAL_DISK_OPERATION ) ; return false ; } this . disk = ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( disk ) ) ; return super . canDoAction ( ) ; }
Source:
public void validateFailsOnNull ( ) { cmd = org.mockito.Mockito.spy ( createTestCommand ( null , null , 0 , 0 , false ) ) ; prepareMocks ( cmd ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
private void initTestCommand ( org.ovirt.engine.core.compat.Guid volumeId , java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity > bricks , int replicaCount , int stripeCount , boolean force ) { cmd.setGlusterVolumeId ( volumeId ) ; cmd.getParameters ( ) . setBricks ( bricks ) ; cmd.getParameters ( ) . setReplicaCount ( replicaCount ) ; cmd.getParameters ( ) . setStripeCount ( stripeCount ) ; cmd.getParameters ( ) . setForce ( force ) ; }
Source:
public static org.ovirt.engine.api.model.OsType map ( int type , java.lang.Class < org.ovirt.engine.api.model.OsType > incomingType ) { java.util.HashMap < java.lang.Integer , java.lang.String > osNames = org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . get ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) . getOsNames ( ) ; java.lang.String name = osNames.get ( type ) ; return org.ovirt.engine.api.model.OsType.valueOf ( org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . get ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) . osNameUpperCasedAndUnderscored ( name ) ) ; }

Target:
public static org.ovirt.engine.api.model.OsType map ( int type , java.lang.Class < org.ovirt.engine.api.model.OsType > incomingType ) { java.util.HashMap < java.lang.Integer , java.lang.String > osUniqueNames = org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . get ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) . getUniqueOsNames ( ) ; java.lang.String name = osUniqueNames.get ( type ) ; return org.ovirt.engine.api.model.OsType.valueOf ( org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . get ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) . osNameUpperCasedAndUnderscored ( name ) ) ; }
Source:
public void testUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.UpdateTag , org.ovirt.engine.core.common.action.TagsOperationParameters.class , new java.lang.String [ ] { "Tag.tag_name" , "Tag.parent_id" } , new java.lang.Object [ ] { NAMES [ 0 ] , org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.PARENT_GUID } , true , true ) ) ; verifyModel ( resource.update ( org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.getModel ( 0 , false ) ) , 0 ) ; }

Target:
public void testUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUpGetEntityExpectations ( 0 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.UpdateTag , org.ovirt.engine.core.common.action.TagsOperationParameters.class , new java.lang.String [ ] { "Tag.TagName" , "Tag.ParentId" } , new java.lang.Object [ ] { NAMES [ 0 ] , org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.PARENT_GUID } , true , true ) ) ; verifyModel ( resource.update ( org.ovirt.engine.api.restapi.resource.BackendTagsResourceTest.getModel ( 0 , false ) ) , 0 ) ; }
Source:
public void testListCrashClientLocale ( ) { javax.ws.rs.core.UriInfo uriInfo = org.ovirt.engine.api.restapi.resource.AbstractBackendDiskProfilesResourceTest.setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpDiskProfilesQueryExpectations ( t ) ; collection.setUriInfo ( uriInfo ) ; try { org.ovirt.engine.api.restapi.resource.AbstractBackendDiskProfilesResourceTest.getCollection ( ) ; org.ovirt.engine.api.restapi.resource.AbstractBackendDiskProfilesResourceTest.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 = org.ovirt.engine.api.restapi.resource.AbstractBackendDiskProfilesResourceTest.setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpDiskProfilesQueryExpectations ( t ) ; collection.setUriInfo ( uriInfo ) ; verifyFault ( org.ovirt.engine.api.restapi.resource.AbstractBackendDiskProfilesResourceTest.assertThrows ( javax.ws.rs.WebApplicationException.class , this :: getCollection ) , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; }
Source:
public void validateFailsWithClusterDoesNotSupportGluster ( ) { cmd = org.mockito.Mockito.spy ( createTestCommand ( getVolume ( 2 , false ) ) ) ; prepareMocks ( cmd ) ; org.mockito.Mockito.doReturn ( getCluster ( false ) ) . when ( clusterDao ) . get ( org.mockito.Mockito.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER ) ; }

Target:
public void validateFailsWithArbiterAndInvalidReplica ( ) { setVolume ( getVolume ( 2 , false , GlusterVolumeType.REPLICATE , 2 , true ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_GLUSTER_ARBITER_VOLUME_SHOULD_BE_REPLICA_3_VOLUME ) ; }
Source:
private org.ovirt.engine.core.compat.Guid getQuotaId ( ) { if ( ( ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) ) != null ) && ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) == ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) . getDiskStorageType ( ) ) ) ) { return ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) ) ) . getQuotaId ( ) ; } return null ; }

Target:
private org.ovirt.engine.core.compat.Guid getQuotaId ( ) { if ( ( ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) ) != null ) && ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) == ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) . getDiskStorageType ( ) ) ) ) { org.ovirt.engine.core.compat.Guid quotaId = ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) ) ) . getQuotaId ( ) ; if ( ! ( Guid.Empty.equals ( quotaId ) ) ) { return quotaId ; } } return null ; }
Source:
public java.util.Set < java.lang.String > getHostNamesForVolume ( org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume ) { java.util.Set < java.lang.String > hosts = new java.util.HashSet < java.lang.String > ( ) ; for ( org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity currentBrick : volume.getBricks ( ) ) { hosts.add ( currentBrick.getServerName ( ) ) ; } return hosts ; }

Target:
public java.util.Set < org.ovirt.engine.core.common.utils.Pair < java.lang.String , org.ovirt.engine.core.compat.Guid > > getHostNamesForVolume ( org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume ) { java.util.Set < org.ovirt.engine.core.common.utils.Pair < java.lang.String , org.ovirt.engine.core.compat.Guid > > hosts = new java.util.HashSet < org.ovirt.engine.core.common.utils.Pair < java.lang.String , org.ovirt.engine.core.compat.Guid > > ( ) ; for ( org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity currentBrick : volume.getBricks ( ) ) { hosts.add ( new org.ovirt.engine.core.common.utils.Pair ( currentBrick.getServerName ( ) , currentBrick.getServerId ( ) ) ) ; } return hosts ; }
Source:
public void testGetAllGlusterVolumesSearch ( ) throws java.lang.Exception { org.ovirt.engine.core.common.queries.SearchParameters searchParam = new org.ovirt.engine.core.common.queries.SearchParameters ( ( "Volumes" + ( org.ovirt.engine.core.common.utils.CommonConstants.QUERY_RETURN_TYPE_SEPARATOR ) ) , org.ovirt.engine.core.common.interfaces.SearchType.GlusterVolume ) ; org.ovirt.engine.core.bll.SearchQuery < org.ovirt.engine.core.common.queries.SearchParameters > searchQuery = spySearchQuery ( searchParam ) ; searchQuery.executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( glusterVolumeList , searchQuery.getQueryReturnValue ( ) . getReturnValue ( ) ) ; }

Target:
public void testGetAllMultiStoragePoolSearch ( ) throws java.lang.Exception { org.mockito.Mockito.when ( getQueryParameters ( ) . getSearchPattern ( ) ) . thenReturn ( ( "Datacenters" + ( org.ovirt.engine.core.common.utils.CommonConstants.QUERY_RETURN_TYPE_SEPARATOR ) ) ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getSearchTypeValue ( ) ) . thenReturn ( SearchType.StoragePool ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( storagePoolResultList , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.VDSGroup setUpVDSGroupExpectations ( org.ovirt.engine.core.compat.Guid id ) { org.ovirt.engine.core.common.businessentities.VDSGroup group = control.createMock ( org.ovirt.engine.core.common.businessentities.VDSGroup.class ) ; org.easymock.EasyMock.expect ( group.getId ( ) ) . andReturn ( id ) . anyTimes ( ) ; setUpEntityQueryExpectations ( VdcQueryType.GetVdsGroupByVdsGroupId , org.ovirt.engine.core.common.queries.GetVdsGroupByVdsGroupIdParameters.class , new java.lang.String [ ] { "VdsGroupId" } , new java.lang.Object [ ] { id } , group ) ; return group ; }

Target:
protected org.ovirt.engine.core.common.businessentities.VDSGroup setUpVDSGroupExpectations ( org.ovirt.engine.core.compat.Guid id ) { org.ovirt.engine.core.common.businessentities.VDSGroup group = control.createMock ( org.ovirt.engine.core.common.businessentities.VDSGroup.class ) ; org.easymock.EasyMock.expect ( group.getId ( ) ) . andReturn ( id ) . anyTimes ( ) ; setUpEntityQueryExpectations ( VdcQueryType.GetVdsGroupByVdsGroupId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { id } , group ) ; return group ; }
Source:
private int getResourceType ( org.ovirt.engine.core.utils.ovf.xml.XmlNode node , java.lang.String resource ) { if ( ( ( node.SelectSingleNode ( resource , _xmlNS ) ) != null ) && ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( node.SelectSingleNode ( resource , _xmlNS ) . innerText ) ) ) ) { return java.lang.Integer.parseInt ( node.SelectSingleNode ( resource , _xmlNS ) . innerText ) ; } return - 1 ; }

Target:
private int getResourceType ( org.ovirt.engine.core.utils.ovf.xml.XmlNode node , java.lang.String resource ) { if ( ( ( selectSingleNode ( node , resource , _xmlNS ) ) != null ) && ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( selectSingleNode ( node , resource , _xmlNS ) . innerText ) ) ) ) { return java.lang.Integer.parseInt ( selectSingleNode ( node , resource , _xmlNS ) . innerText ) ; } return - 1 ; }
Source:
public static void getVmGuestAgentInterfacesByVmId ( 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 ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmGuestAgentInterfacesByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }

Target:
public static void getVnicProfilesByDcId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dcId ) { if ( ( aQuery.converterCallback ) == null ) { 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.network.VnicProfileView > ( ) ; } return source ; } } ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVnicProfilesByDataCenterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dcId ) , aQuery ) ; }
Source:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume = getGlusterVolume ( ) ; if ( volume.isOnline ( ) ) { addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED ) ; addCanDoActionMessageVariable ( "volumeName" , volume.getName ( ) ) ; return false ; } return true ; }

Target:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume = getGlusterVolume ( ) ; if ( ( volume.isOnline ( ) ) && ( ! ( getParameters ( ) . isForceAction ( ) ) ) ) { addCanDoActionMessage ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED ) ; addCanDoActionMessageVariable ( "volumeName" , volume.getName ( ) ) ; return false ; } return true ; }
Source:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { stopProgress ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase res = result.getReturnValue ( ) ; if ( ( res == null ) || ( ! ( res.getSucceeded ( ) ) ) ) { return ; } cancel ( ) ; sourceListModel.getSearchCommand ( ) . execute ( ) ; }

Target:
private void cancel ( ) { sourceListModel.setWindow ( null ) ; }
Source:
public boolean runForSingleConnectionInHost ( org.ovirt.engine.core.common.businessentities.storage_domains storageDomain , org.ovirt.engine.core.compat.Guid storagePoolId , int type ) { org.ovirt.engine.core.common.businessentities.storage_pool pool = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStoragePoolDao ( ) . get ( storagePoolId ) ; if ( ( pool.getspm_vds_id ( ) ) != null ) { return runConnectionStorageToDomain ( storageDomain , pool.getspm_vds_id ( ) . getValue ( ) , type ) ; } else { log.errorFormat ( "Pool {0} does not have spm vds id to connect storage to domain." , pool.getname ( ) ) ; return false ; } }

Target:
public boolean disconnectStorageFromDomainByVdsId ( org.ovirt.engine.core.common.businessentities.storage_domains storageDomain , org.ovirt.engine.core.compat.Guid vdsId ) { return runConnectionStorageToDomain ( storageDomain , vdsId , VdcActionType.DisconnectStorageServerConnection.getValue ( ) ) ; }
Source:
public static void IsHotPlugAvailable ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.HotPlugEnabled ) ; tempVar.setVersion ( version ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( tempVar , 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.ui.uicommonweb.Linq.VdsGroupByNameComparer ( ) ) ; return list ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllVdsGroups , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
public void canDoActionFailsOnNullHookId ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookStatusChangeParameters ( CLUSTER_ID , null ) ) ) ; setupMocks ( cmd ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED.toString ( ) ) ) ; }

Target:
public void canDoActionFailsOnNullHook ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd , false ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString ( ) ) ) ; }