auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGenerateSpecParams ( ) { org.ovirt.engine.core.common.businessentities.VmRngDevice dev = new org.ovirt.engine.core.common.businessentities.VmRngDevice ( ) ; dev.setSource ( VmRngDevice.Source.HWRNG ) ; java.util.Map < java.lang.String , java.lang.Object > expectedParams = new java.util.HashMap < > ( ) ; expectedParams.put ( "source" , "hwrng" ) ; org.junit.Assert.assertEquals ( expectedParams , dev.getSpecParams ( ) ) ; }

Target:
public void testGenerateSpecParams ( ) { org.ovirt.engine.core.common.businessentities.VmRngDevice dev = new org.ovirt.engine.core.common.businessentities.VmRngDevice ( ) ; dev.setSource ( VmRngDevice.Source.HWRNG ) ; java.util.Map < java.lang.String , java.lang.Object > expectedParams = new java.util.HashMap < > ( ) ; expectedParams.put ( "source" , "hwrng" ) ; org.junit.jupiter.api.Assertions.assertEquals ( expectedParams , dev.getSpecParams ( ) ) ; }
Source:
private org.ovirt.engine.core.bll.ValidationResult validateCoherentNicIdentification ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment ) { return validateCoherentIdentification ( attachment.getId ( ) , attachment.getNicId ( ) , attachment.getNicName ( ) , VdcBllMessages.NETWORK_ATTACHMENT_REFERENCES_NICS_INCOHERENTLY , existingInterfacesMap ) ; }

Target:
private < T extends org.ovirt.engine.core.common.businessentities.BusinessEntity < org.ovirt.engine.core.compat.Guid > & org.ovirt.engine.core.common.businessentities.Nameable > org.ovirt.engine.core.bll.ValidationResult validateCoherentIdentification ( org.ovirt.engine.core.compat.Guid violatingEntityId , org.ovirt.engine.core.compat.Guid referringId , java.lang.String referringName , org.ovirt.engine.core.common.errors.EngineMessage message , org.ovirt.engine.core.common.businessentities.BusinessEntityMap < T > map ) { boolean bothIdentificationSet = ( referringId != null ) && ( referringName != null ) ; java.lang.String [ ] replacements = createIncoherentIdentificationErrorReplacements ( violatingEntityId , referringId , referringName ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( message , replacements ) . when ( ( bothIdentificationSet && ( isNameAndIdIncoherent ( referringId , referringName , map ) ) ) ) ; }
Source:
private void addGhostEntry ( ) { addEntry ( createGhostValue ( ) ) ; }

Target:
public void edit ( final M model ) { if ( ( this . model ) != null ) { this . model.getItemsChangedEvent ( ) . removeListener ( itemsChangedListener ) ; } this . model = model ; model.getItemsChangedEvent ( ) . addListener ( itemsChangedListener ) ; init ( model ) ; }
Source:
public static void GetMaxNumOfVmCpus ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 1 ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxNumOfVmCpus ) ; tempVar.setVersion ( version ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( tempVar , aQuery ) ; }

Target:
public static void GetWANColorDepth ( 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 ? org.ovirt.engine.ui.uicommonweb.models.vms.WanColorDepth.fromInt ( ( ( java.lang.Integer ) ( source ) ) . intValue ( ) ) : org.ovirt.engine.ui.uicommonweb.models.vms.WanColorDepth.depth16 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.WANColorDepth ) , aQuery ) ; }
Source:
public static 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.RunQuery ( VdcQueryType.GetServerSSHKeyFingerprint , new org.ovirt.engine.core.common.queries.ServerParameters ( hostAddress ) , aQuery ) ; }

Target:
public static void getStorageDomainById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storageDomainId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( storageDomainId ) , aQuery ) ; }
Source:
public java.lang.String getHostNameOrIP ( org.ovirt.engine.core.compat.Guid glusterHostUuid ) { java.lang.String hostName = null ; if ( glusterHostUuid != null ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterServer glusterServer = getGlusterServerDao ( ) . getByGlusterServerUuid ( glusterHostUuid ) ; if ( glusterServer != null ) { org.ovirt.engine.core.common.businessentities.VdsStatic vds = getVdsStaticDao ( ) . get ( glusterServer.getId ( ) ) ; if ( vds != null ) { hostName = vds.getHostName ( ) ; } } } return hostName ; }

Target:
public org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity getGlusterBrickByServerUuidAndBrickDir ( org.ovirt.engine.core.compat.Guid serverId , java.lang.String brickDir ) { return glusterBrickDao.getBrickByServerIdAndDirectory ( serverId , brickDir ) ; }
Source:
private void insertOrUpdate ( final org.ovirt.engine.core.common.businessentities.ad_groups group , final java.lang.String storedProcName ) { getCallsHandler ( ) . executeModification ( storedProcName , getCustomMapSqlParameterSource ( ) . addValue ( "id" , group.getid ( ) ) . addValue ( "name" , group.getname ( ) ) . addValue ( "status" , group.getstatus ( ) ) . addValue ( "domain" , group.getdomain ( ) ) . addValue ( "distinguishedname" , group.getDistinguishedName ( ) ) ) ; }

Target:
private void insertOrUpdate ( final org.ovirt.engine.core.common.businessentities.LdapGroup group , final java.lang.String storedProcName ) { getCallsHandler ( ) . executeModification ( storedProcName , getCustomMapSqlParameterSource ( ) . addValue ( "id" , group.getid ( ) ) . addValue ( "name" , group.getname ( ) ) . addValue ( "status" , group.getstatus ( ) ) . addValue ( "domain" , group.getdomain ( ) ) . addValue ( "distinguishedname" , group.getDistinguishedName ( ) ) ) ; }
Source:
public void save ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster cluster ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "cluster_id" , cluster.getcluster_id ( ) ) . addValue ( "network_id" , cluster.getnetwork_id ( ) ) . addValue ( "status" , cluster.getstatus ( ) ) . addValue ( "is_display" , cluster.getis_display ( ) ) . addValue ( "required" , cluster.isRequired ( ) ) ; getCallsHandler ( ) . executeModification ( "Insertnetwork_cluster" , parameterSource ) ; }

Target:
public void save ( org.ovirt.engine.core.common.businessentities.network.NetworkCluster cluster ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "cluster_id" , cluster.getClusterId ( ) ) . addValue ( "network_id" , cluster.getNetworkId ( ) ) . addValue ( "status" , cluster.getStatus ( ) ) . addValue ( "is_display" , cluster.isDisplay ( ) ) . addValue ( "required" , cluster.isRequired ( ) ) ; getCallsHandler ( ) . executeModification ( "Insertnetwork_cluster" , parameterSource ) ; }
Source:
public boolean ValidateStoragePoolConnectionsInHost ( org.ovirt.engine.core.common.businessentities.VDS vds , java.util.List < org.ovirt.engine.core.common.businessentities.storage_server_connections > connections , org.ovirt.engine.core.compat.Guid storagePoolId ) { if ( ( connections.size ( ) ) > 0 ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) java.util.Map < java.lang.String , java.lang.String > validateConnections = ( ( java.util.Map < java.lang.String , java.lang.String > ) ( org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.ValidateStorageServerConnection , new org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters ( vds.getId ( ) , storagePoolId , org.ovirt.engine.core.common.businessentities.StorageType.ISCSI , connections ) ) . getReturnValue ( ) ) ) ; return IsConnectSucceeded ( validateConnections , connections ) ; } return true ; }

Target:
public boolean validateStoragePoolConnectionsInHost ( org.ovirt.engine.core.common.businessentities.VDS vds , java.util.List < org.ovirt.engine.core.common.businessentities.StorageServerConnections > connections , org.ovirt.engine.core.compat.Guid storagePoolId ) { if ( ( connections.size ( ) ) > 0 ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) java.util.Map < java.lang.String , java.lang.String > validateConnections = ( ( java.util.Map < java.lang.String , java.lang.String > ) ( org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.ValidateStorageServerConnection , new org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters ( vds.getId ( ) , storagePoolId , org.ovirt.engine.core.common.businessentities.StorageType.ISCSI , connections ) ) . getReturnValue ( ) ) ) ; return IsConnectSucceeded ( validateConnections , connections ) ; } return true ; }
Source:
public void testGetNotFound ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpBasicUriExpectations ( ) ; setUriInfo ( uriInfo ) ; setUpGetEntityExpectations ( 2 ) ; initParetResource ( resource.parent , uriInfo ) ; control.replay ( ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
protected void verifyModel ( org.ovirt.engine.api.model.Group model , int index ) { assertEquals ( GUIDS [ index ] . toString ( ) , model.getId ( ) ) ; assertEquals ( NAMES [ index ] , model.getName ( ) ) ; }
Source:
private static org.ovirt.engine.core.common.businessentities.Role randomRole ( ) { org.ovirt.engine.core.utils.RandomUtils random = org.ovirt.engine.core.utils.RandomUtils.instance ( ) ; org.ovirt.engine.core.common.businessentities.Role role = new org.ovirt.engine.core.common.businessentities.Role ( ) ; role.setdescription ( random.nextString ( 10 ) ) ; role.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; role.setname ( random.nextString ( 10 ) ) ; return role ; }

Target:
private static org.ovirt.engine.core.common.businessentities.Role randomRole ( ) { org.ovirt.engine.core.utils.RandomUtils random = org.ovirt.engine.core.utils.RandomUtils.instance ( ) ; org.ovirt.engine.core.common.businessentities.Role role = new org.ovirt.engine.core.common.businessentities.Role ( ) ; role.setDescription ( random.nextString ( 10 ) ) ; role.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; role.setName ( random.nextString ( 10 ) ) ; return role ; }
Source:
private java.lang.String getJsession ( ) { if ( ( ( this . pool.getCookies ( ) ) != null ) && ( ! ( this . pool.getCookies ( ) . isEmpty ( ) ) ) ) { for ( org.apache.http.cookie.Cookie cookie : this . pool.getCookies ( ) ) { if ( cookie.getName ( ) . equals ( org.ovirt.engine.sdk.web.HttpProxy.JSESSIONID ) ) { return cookie.getValue ( ) ; } } } return null ; }

Target:
public boolean isSetSessionid ( ) { return ! ( org.ovirt.engine.sdk.utils.StringUtils.isNulOrEmpty ( this . sessionid ) ) ; }
Source:
protected void addInvalidSDStatusMessage ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus status ) { addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2 ) ; addCanDoActionMessage ( java.lang.String.format ( "$status %1$s" , status ) ) ; }

Target:
protected org.ovirt.engine.core.compat.Guid getNewMasterStorageDomainId ( ) { if ( ( newMasterStorageDomainId ) == null ) { newMasterStorageDomain = electNewMaster ( true , org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.getParameters ( ) . isCanChooseInactiveDomainAsMaster ( ) , org.ovirt.engine.core.bll.storage.ReconstructMasterDomainCommand.getParameters ( ) . isCanChooseCurrentMasterAsNewMaster ( ) ) ; newMasterStorageDomainId = ( ( newMasterStorageDomain ) != null ) ? newMasterStorageDomain.getId ( ) : org.ovirt.engine.core.compat.Guid.Empty ; } return newMasterStorageDomainId ; }
Source:
public void testValidationFailsDiskConnectedToRunningVm ( ) { org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm.setStatus ( VMStatus.Up ) ; org.ovirt.engine.core.common.businessentities.VmDevice vmDevice = new org.ovirt.engine.core.common.businessentities.VmDevice ( ) ; vmDevice.setPlugged ( true ) ; java.util.List < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.businessentities.VM , org.ovirt.engine.core.common.businessentities.VmDevice > > vms = java.util.Collections.singletonList ( new org.ovirt.engine.core.common.utils.Pair ( vm , vmDevice ) ) ; org.mockito.Mockito.doReturn ( vms ) . when ( vmDao ) . getVmsWithPlugInfo ( diskId ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN ) ; }

Target:
public void testValidationFailsDiskConnectedToRunningVm ( ) { org.mockito.Mockito.when ( diskValidator.isDiskPluggedToVmsThatAreNotDown ( org.mockito.ArgumentMatchers.anyBoolean ( ) , org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN ) ; }
Source:
public void getVmList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String poolName ) { 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 ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VM > vms = org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.VM > cast ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.IVdcQueryable > ) ( source ) ) ) ; return vms ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.Search , new org.ovirt.engine.core.common.queries.SearchParameters ( ( "Vms: pool=" + poolName ) , org.ovirt.engine.core.common.interfaces.SearchType.VM ) , aQuery ) ; }

Target:
public void getLunsByVgId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String vgId , org.ovirt.engine.core.compat.Guid vdsId ) { 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.storage.LUNs > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.LUNs > ( ) ; } } ; org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters params = new org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters ( vgId , vdsId ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetLunsByVgId , params , aQuery ) ; }
Source:
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 > ( ) ; }

Target:
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 ) ) ; return org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getClusterByServiceList ( list , supportsVirtService , supportsGlusterService ) ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ( ) ; }
Source:
public void testValidateNotEnoughSpace ( ) { prepareForVmValidatorTests ( ) ; spySdValidator ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > imagesDisks = mockDisksList ( 4 ) ; org.mockito.Mockito.when ( storageDomainsValidator.allDomainsHaveSpaceForClonedDisks ( imagesDisks ) ) . thenReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ; }

Target:
public void testValidateEnoughSpace ( ) { prepareForVmValidatorTests ( ) ; spySdValidator ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > parentSnapshots = mockDisksList ( 2 ) ; org.mockito.Mockito.doReturn ( parentSnapshots ) . when ( cmd ) . getSourceImages ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( cmd ) ; }
Source:
public void testValidateAndSetStorageQuota ( ) throws java.lang.Exception { }

Target:
public void testValidateAndSetStorageQuotaSpecificOverGrace ( ) throws java.lang.Exception { java.util.List < org.ovirt.engine.core.bll.quota.StorageQuotaValidationParameter > parameters = new java.util.ArrayList < org.ovirt.engine.core.bll.quota.StorageQuotaValidationParameter > ( ) ; parameters.add ( new org.ovirt.engine.core.bll.quota.StorageQuotaValidationParameter ( org.ovirt.engine.core.bll.quota.QuotaManagerTest.STORAGE_QUOTA_SPECIFIC_OVER_GRACE , org.ovirt.engine.core.bll.quota.QuotaManagerTest.DESTINATION_GUID , 1 ) ) ; org.junit.Assert.assertFalse ( quotaManager.validateAndSetStorageQuota ( storage_pool , parameters , canDoActionMessages ) ) ; assertNotEmptyCanDoActionMessage ( ) ; assertAuditLogWritten ( ) ; }
Source:
private boolean interfaceOrItsVlanDoesNotHaveNetworkOrOneIsAboutToBeRemovedFromIt ( java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.NetworkAttachment > removedNetworkAttachmentsByNicName , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface potentialSlave ) { boolean validSlave = interfaceDoesNotHaveNetworkOrOneIsAboutToBeRemovedFromIt ( removedNetworkAttachmentsByNicName , potentialSlave ) ; java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > vlanInterfacesForInterface = vlanInterfacesForInterface ( potentialSlave ) ; for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface vdsNetworkInterface : vlanInterfacesForInterface ) { validSlave = validSlave && ( interfaceDoesNotHaveNetworkOrOneIsAboutToBeRemovedFromIt ( removedNetworkAttachmentsByNicName , vdsNetworkInterface ) ) ; } return validSlave ; }

Target:
org.ovirt.engine.core.bll.ValidationResult modifiedAttachmentNotRemoved ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment ) { org.ovirt.engine.core.compat.Guid networkAttachmentId = networkAttachment.getId ( ) ; if ( isNewAttachment ( networkAttachmentId ) ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } boolean attachmentInRemoveList = params.getRemovedNetworkAttachments ( ) . contains ( networkAttachmentId ) ; return org.ovirt.engine.core.bll.ValidationResult.failWith ( EngineMessage.NETWORK_ATTACHMENT_IN_BOTH_LISTS , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( "NETWORK_ATTACHMENT_IN_BOTH_LISTS_ENTITY" , networkAttachmentId.toString ( ) ) ) . when ( attachmentInRemoveList ) ; }
Source:
private boolean deleteGlusterVolumeSnapshot ( org.ovirt.engine.core.compat.Guid serverId , java.lang.String volumeName , java.lang.String snapshotName ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.DeleteGlusterVolumeSnapshot , new org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters ( serverId , volumeName , snapshotName ) ) ; setSucceeded ( retVal.getSucceeded ( ) ) ; if ( ! ( getSucceeded ( ) ) ) { handleVdsError ( AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DELETE_FAILED , retVal.getVdsError ( ) . getMessage ( ) ) ; return false ; } else { getGlusterVolumeSnapshotDao ( ) . remove ( getSnapshot ( ) . getId ( ) ) ; } return true ; }

Target:
private boolean deleteGlusterVolumeSnapshot ( org.ovirt.engine.core.compat.Guid serverId , java.lang.String volumeName , java.lang.String snapshotName ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.DeleteGlusterVolumeSnapshot , new org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters ( serverId , volumeName , snapshotName ) ) ; setSucceeded ( retVal.getSucceeded ( ) ) ; if ( ! ( getSucceeded ( ) ) ) { handleVdsError ( AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DELETE_FAILED , retVal.getVdsError ( ) . getMessage ( ) ) ; return false ; } else { glusterVolumeSnapshotDao.remove ( getSnapshot ( ) . getId ( ) ) ; } return true ; }
Source:
protected void assertErrors ( org.ovirt.engine.ui.uicommonweb.action.UiAction.ActionFlowState flowState , int expectedNumOfErrors ) { int numOfErrors = 0 ; for ( java.util.List < org.ovirt.engine.core.common.action.ActionReturnValue > values : flowState.getFailedActionsMap ( ) . values ( ) ) { numOfErrors += values.size ( ) ; } org.junit.Assert.assertEquals ( expectedNumOfErrors , numOfErrors ) ; }

Target:
protected void assertErrors ( org.ovirt.engine.ui.uicommonweb.action.UiAction.ActionFlowState flowState , int expectedNumOfErrors ) { int numOfErrors = 0 ; for ( java.util.List < org.ovirt.engine.core.common.action.ActionReturnValue > values : flowState.getFailedActionsMap ( ) . values ( ) ) { numOfErrors += values.size ( ) ; } org.junit.jupiter.api.Assertions.assertEquals ( expectedNumOfErrors , numOfErrors ) ; }
Source:
public void canDoActionInvalidSourceDomain ( ) { createParameters ( ) ; org.ovirt.engine.core.common.businessentities.storage_domains storageDomain = initStorageDomain ( srcStorageId ) ; storageDomain.setstatus ( StorageDomainStatus.Locked ) ; initDiskImage ( diskImageId ) ; initVm ( VMStatus.Up , org.ovirt.engine.core.compat.Guid.NewGuid ( ) , diskImageId ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL.toString ( ) ) ) ; }

Target:
public void canDoActionInvalidSourceDomain ( ) { createParameters ( ) ; org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain = initStorageDomain ( srcStorageId ) ; storageDomain.setStatus ( StorageDomainStatus.Locked ) ; initDiskImage ( diskImageId ) ; initVm ( VMStatus.Up , org.ovirt.engine.core.compat.Guid.NewGuid ( ) , diskImageId ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL.toString ( ) ) ) ; }
Source:
private void updateModifiedInterfaces ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > nicsForUpdate = prepareNicsForUpdate ( ) ; if ( ! ( nicsForUpdate.isEmpty ( ) ) ) { interfaceDao.massUpdateInterfacesForVds ( getNicsForUpdate ( ) ) ; } }

Target:
private void updateModifiedInterfaces ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > nicsForUpdate = getNicsForUpdate ( ) ; java.util.List < org.ovirt.engine.core.compat.Guid > updateNicsIds = org.ovirt.engine.core.common.businessentities.Entities.getIds ( nicsForUpdate ) ; if ( ! ( nicsForUpdate.isEmpty ( ) ) ) { interfaceDao.massClearNetworkFromNics ( updateNicsIds ) ; interfaceDao.massUpdateInterfacesForVds ( nicsForUpdate ) ; } }
Source:
private void hostName_SelectedItemChanged ( ) { org.ovirt.engine.core.common.businessentities.VDS host = getExternalHostName ( ) . getSelectedItem ( ) ; if ( host == null ) { host = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; } updateModelFromVds ( host , null , false , null ) ; }

Target:
private void hostName_SelectedItemChanged ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = ( ( org.ovirt.engine.core.common.businessentities.VDS ) ( getExternalHostName ( ) . getSelectedItem ( ) ) ) ; if ( vds == null ) { vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; } updateModelFromVds ( vds , null , false , null ) ; getHost ( ) . setIsChangable ( false ) ; }
Source:
public void validateSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DeleteGlusterVolumeCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters ( stoppedVolumeId , false ) , null ) ) ; prepareMocks ( cmd ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void prepareMocks ( ) { org.mockito.Mockito.doReturn ( volumeDao ) . when ( cmd ) . getGlusterVolumeDao ( ) ; org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( cmd ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( stoppedVolumeId ) ) . when ( volumeDao ) . getById ( stoppedVolumeId ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( startedVolumeId ) ) . when ( volumeDao ) . getById ( startedVolumeId ) ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.VmStatic vmStatic = org.ovirt.engine.core.bll.AddVmAndAttachToPoolCommand.getParameters ( ) . getVmStaticData ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValueFromAddVm ; if ( VmTemplateHandler.BlankVmTemplateId.equals ( vmStatic.getVmtGuid ( ) ) ) { returnValueFromAddVm = addVmFromScratch ( vmStatic ) ; } else { returnValueFromAddVm = addVm ( vmStatic ) ; } if ( returnValueFromAddVm.getSucceeded ( ) ) { org.ovirt.engine.core.bll.AddVmAndAttachToPoolCommand.getTaskIdList ( ) . addAll ( returnValueFromAddVm.getInternalVdsmTaskIdList ( ) ) ; addVmToPool ( vmStatic ) ; } }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.VmStatic vmStatic = org.ovirt.engine.core.bll.AddVmAndAttachToPoolCommand.getParameters ( ) . getVmStaticData ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValueFromAddVm ; if ( VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals ( vmStatic.getVmtGuid ( ) ) ) { returnValueFromAddVm = addVmFromScratch ( vmStatic ) ; } else { returnValueFromAddVm = addVm ( vmStatic ) ; } if ( returnValueFromAddVm.getSucceeded ( ) ) { org.ovirt.engine.core.bll.AddVmAndAttachToPoolCommand.getTaskIdList ( ) . addAll ( returnValueFromAddVm.getInternalVdsmTaskIdList ( ) ) ; addVmToPool ( vmStatic ) ; } }
Source:
public boolean isFenceAgentVersionCompatible ( org.ovirt.engine.core.common.businessentities.pm.FenceAgent agent , java.lang.String clusterCompatibilityVersion , java.util.List < java.lang.String > messages ) { if ( ! ( org.ovirt.engine.core.compat.Regex.isMatch ( org.ovirt.engine.core.utils.pm.FenceConfigHelper.getFenceConfigurationValue ( ConfigValues.VdsFenceType.name ( ) , clusterCompatibilityVersion ) , java.lang.String.format ( "(,|^)%1$s(,|$)" , agent.getType ( ) ) ) ) ) { messages.add ( EngineMessage.ACTION_TYPE_FAILED_AGENT_NOT_SUPPORTED.name ( ) ) ; return false ; } else { return true ; } }

Target:
public boolean isFenceAgentVersionCompatible ( org.ovirt.engine.core.common.businessentities.pm.FenceAgent agent , java.lang.String clusterCompatibilityVersion , java.util.List < java.lang.String > messages ) { if ( ! ( java.util.regex.Pattern.compile ( java.lang.String.format ( "(,|^)%1$s(,|$)" , agent.getType ( ) ) ) . matcher ( org.ovirt.engine.core.utils.pm.FenceConfigHelper.getFenceConfigurationValue ( ConfigValues.VdsFenceType.name ( ) , clusterCompatibilityVersion ) ) . find ( ) ) ) { messages.add ( EngineMessage.ACTION_TYPE_FAILED_AGENT_NOT_SUPPORTED.name ( ) ) ; return false ; } else { return true ; } }
Source:
public void rollback ( ) { super . rollback ( ) ; poolPerDc.removePool ( getMacPoolId ( ) ) ; }

Target:
protected void executeCommand ( ) { registerRollbackHandler ( new org.ovirt.engine.core.bll.AddMacPoolCommand.CustomTransactionCompletionListener ( ) ) ; getMacPoolEntity ( ) . setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; getMacPoolDao ( ) . save ( getMacPoolEntity ( ) ) ; addPermission ( getCurrentUser ( ) . getId ( ) , getMacPoolEntity ( ) . getId ( ) ) ; macPoolPerCluster.createPool ( getMacPoolEntity ( ) ) ; setSucceeded ( true ) ; getReturnValue ( ) . setActionReturnValue ( getMacPoolId ( ) ) ; }
Source:
public static boolean isDataActiveStorageDomain ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { boolean isData = ( ( storageDomain.getStorageDomainType ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainType.Data ) ) || ( ( storageDomain.getStorageDomainType ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainType.Master ) ) ; boolean isActive = org.ovirt.engine.ui.uicommonweb.Linq.isActiveStorageDomain ( storageDomain ) ; return isData && isActive ; }

Target:
public static boolean isDataActiveStorageDomain ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { boolean isData = storageDomain.getStorageDomainType ( ) . isDataDomain ( ) ; boolean isActive = org.ovirt.engine.ui.uicommonweb.Linq.isActiveStorageDomain ( storageDomain ) ; return isData && isActive ; }
Source:
public static org.ovirt.engine.api.model.StorageDomainStatus map ( org.ovirt.engine.api.model.StorageDomainStatus status , org.ovirt.engine.api.model.StorageDomainStatus template ) { switch ( status ) { case Unattached : return org.ovirt.engine.api.model.StorageDomainStatus.UNATTACHED ; case Active : return org.ovirt.engine.api.model.StorageDomainStatus.ACTIVE ; case InActive : return org.ovirt.engine.api.model.StorageDomainStatus.INACTIVE ; case Locked : return org.ovirt.engine.api.model.StorageDomainStatus.LOCKED ; case PreparingForMaintenance : return org.ovirt.engine.api.model.StorageDomainStatus.PREPARING_FOR_MAINTENANCE ; case Maintenance : return org.ovirt.engine.api.model.StorageDomainStatus.MAINTENANCE ; case Unknown : return org.ovirt.engine.api.model.StorageDomainStatus.UNKNOWN ; case Uninitialized : return null ; default : return null ; } }

Target:
public static org.ovirt.engine.api.model.StorageDomainStatus map ( org.ovirt.engine.api.model.StorageDomainStatus status , org.ovirt.engine.api.model.StorageDomainStatus template ) { switch ( status ) { case Unattached : return org.ovirt.engine.api.model.StorageDomainStatus.UNATTACHED ; case Active : return org.ovirt.engine.api.model.StorageDomainStatus.ACTIVE ; case Inactive : return org.ovirt.engine.api.model.StorageDomainStatus.INACTIVE ; case Locked : return org.ovirt.engine.api.model.StorageDomainStatus.LOCKED ; case PreparingForMaintenance : return org.ovirt.engine.api.model.StorageDomainStatus.PREPARING_FOR_MAINTENANCE ; case Detaching : return org.ovirt.engine.api.model.StorageDomainStatus.DETACHING ; case Maintenance : return org.ovirt.engine.api.model.StorageDomainStatus.MAINTENANCE ; case Unknown : return org.ovirt.engine.api.model.StorageDomainStatus.UNKNOWN ; case Uninitialized : return null ; default : return null ; } }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceModel ) ( sender ) ) ; java.lang.String propertyName = args.propertyName ; if ( ( "BootProtocolsAvailable" . equals ( propertyName ) ) || ( "NoneBootProtocolAvailable" . equals ( propertyName ) ) ) { enableDisableByBootProtocol ( model ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkAttachmentModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkAttachmentModel ) ( sender ) ) ; java.lang.String propertyName = args.propertyName ; if ( ( "BootProtocolsAvailable" . equals ( propertyName ) ) || ( "NoneBootProtocolAvailable" . equals ( propertyName ) ) ) { enableDisableByBootProtocol ( model ) ; } }
Source:
private void refreshServerData ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster , org.ovirt.engine.core.common.businessentities.VDS upServer , java.util.List < org.ovirt.engine.core.common.businessentities.VDS > existingServers ) { if ( cluster.supportsVirtService ( ) ) { org.ovirt.engine.core.bll.gluster.GlusterManager.log.debugFormat ( "As cluster {0} supports virt service as well, it's servers will not be synced with glusterfs" , cluster.getname ( ) ) ; return ; } java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo > fetchedServers = fetchServers ( cluster , upServer , existingServers ) ; if ( fetchedServers != null ) { removeDetachedServers ( existingServers , fetchedServers ) ; } }

Target:
private void refreshServerData ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster , org.ovirt.engine.core.common.businessentities.VDS upServer , java.util.List < org.ovirt.engine.core.common.businessentities.VDS > existingServers ) { if ( cluster.supportsVirtService ( ) ) { log.debugFormat ( "As cluster {0} supports virt service as well, it's servers will not be synced with glusterfs" , cluster.getname ( ) ) ; return ; } acquireLock ( cluster.getId ( ) ) ; try { java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo > fetchedServers = fetchServers ( cluster , upServer , existingServers ) ; if ( fetchedServers != null ) { removeDetachedServers ( existingServers , fetchedServers ) ; } } finally { releaseLock ( cluster.getId ( ) ) ; } }
Source:
public void testGetRootWithHierarchy ( ) { org.ovirt.engine.core.common.businessentities.Tags tag = createTag ( "tag1" , "desc1" ) ; tagsDirector.AddTag ( tag ) ; org.ovirt.engine.core.common.businessentities.Tags tags = tagsDirector.GetRootTag ( ) ; org.junit.Assert.assertNotNull ( tags ) ; org.junit.Assert.assertEquals ( tags.gettag_id ( ) , TagsDirector.ROOT_TAG_ID ) ; org.junit.Assert.assertEquals ( 1 , tags.getChildren ( ) . size ( ) ) ; org.junit.Assert.assertEquals ( "tag1" , tags.getChildren ( ) . get ( 0 ) . gettag_name ( ) ) ; }

Target:
public void testGetRootWithHierarchy ( ) { org.ovirt.engine.core.common.businessentities.Tags tag = createTag ( "tag1" , "desc1" ) ; tagsDirector.addTag ( tag ) ; org.ovirt.engine.core.common.businessentities.Tags tags = tagsDirector.getRootTag ( ) ; org.junit.Assert.assertNotNull ( tags ) ; org.junit.Assert.assertEquals ( tags.gettag_id ( ) , TagsDirector.ROOT_TAG_ID ) ; org.junit.Assert.assertEquals ( 1 , tags.getChildren ( ) . size ( ) ) ; org.junit.Assert.assertEquals ( "tag1" , tags.getChildren ( ) . get ( 0 ) . gettag_name ( ) ) ; }
Source:
public static void getAllProvidersByType ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.common.businessentities.ProviderType providerType ) { 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.Provider > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllProviders , new org.ovirt.engine.core.common.queries.GetAllProvidersParameters ( providerType ) , aQuery ) ; }

Target:
public void getExternalProviderHostGroupList ( 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.ExternalHostGroup > ( ) ; } 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.GetHostGroupsFromExternalProvider , params , aQuery ) ; }
Source:
protected static java.lang.Object determineMessage ( org.ovirt.engine.core.utils.log.Log log , org.ovirt.engine.core.utils.log.Logged logged , java.lang.Object obj ) { if ( ( logged != null ) && ( ! ( org.ovirt.engine.core.utils.log.LoggedUtils.isLogLevelOn ( log , org.ovirt.engine.core.utils.log.Logged.LogLevel.getMinimalLevel ( logged.parametersLevel ( ) , logged.executionLevel ( ) ) ) ) ) ) { return obj.getClass ( ) . getName ( ) ; } return obj ; }

Target:
protected static java.lang.Object determineMessage ( org.slf4j.Logger log , org.ovirt.engine.core.utils.log.Logged logged , java.lang.Object obj ) { if ( ( logged != null ) && ( ! ( org.ovirt.engine.core.utils.log.LoggedUtils.isLogLevelOn ( log , org.ovirt.engine.core.utils.log.Logged.LogLevel.getMinimalLevel ( logged.parametersLevel ( ) , logged.executionLevel ( ) ) ) ) ) ) { return obj.getClass ( ) . getName ( ) ; } return obj ; }
Source:
public void getStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }

Target:
public void getHostById ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVdsByVdsId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }
Source:
public void testExecuteQueryVmWithMultipleDisks ( ) throws java.lang.Exception { mockDaoForQuery ( ) ; vm = mockVmAndReturnFromDao ( ) ; populateVmDiskMap ( vm , 5 ) ; java.lang.String expectedDiskAlias = org.ovirt.engine.core.bll.ImagesHandler.getDefaultDiskAlias ( vm.getName ( ) , "6" ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( expectedDiskAlias , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }

Target:
public void testExecuteQueryVmWithMultipleDisks ( ) throws java.lang.Exception { mockDaoForQuery ( ) ; vm = mockVmAndReturnFromDao ( ) ; org.ovirt.engine.core.bll.GetNextAvailableDiskAliasNameByVMIdQueryTest.populateVmDiskMap ( vm , 5 ) ; java.lang.String expectedDiskAlias = org.ovirt.engine.core.bll.ImagesHandler.getDefaultDiskAlias ( vm.getName ( ) , "6" ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( expectedDiskAlias , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }
Source:
public void onFailureResetInitialStatus ( ) { mockExecutor ( false ) ; try { command.executeCommand ( ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException exception ) { org.mockito.Mockito.verify ( vdsBrokerFrontend ) . RunVdsCommand ( org.mockito.Matchers.eq ( VDSCommandType.SetVdsStatus ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters.class ) ) ; return ; } org.junit.Assert.fail ( ) ; }

Target:
public void onFailureResetInitialStatus ( ) { mockExecutor ( false ) ; try { command.executeCommand ( ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException exception ) { org.mockito.Mockito.verify ( vdsBrokerFrontend ) . runVdsCommand ( org.mockito.Matchers.eq ( VDSCommandType.SetVdsStatus ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters.class ) ) ; return ; } org.junit.Assert.fail ( ) ; }
Source:
private void stpTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , boolean vmNetwork , boolean stp ) { org.mockito.Mockito.when ( network.isVmNetwork ( ) ) . thenReturn ( vmNetwork ) ; org.mockito.Mockito.when ( network.getStp ( ) ) . thenReturn ( stp ) ; org.junit.Assert.assertThat ( validator.stpForVmNetworkOnly ( ) , matcher ) ; }

Target:
private void stpTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , boolean vmNetwork , boolean stp ) { org.mockito.Mockito.when ( network.isVmNetwork ( ) ) . thenReturn ( vmNetwork ) ; org.mockito.Mockito.when ( network.getStp ( ) ) . thenReturn ( stp ) ; org.hamcrest.MatcherAssert.assertThat ( validator.stpForVmNetworkOnly ( ) , matcher ) ; }
Source:
private static void addUsbSlots ( org.ovirt.engine.core.common.businessentities.VmBase vm , int numOfSlots ) { for ( int index = 1 ; index <= numOfSlots ; index ++ ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , vm.getId ( ) ) , VmDeviceGeneralType.REDIR , VmDeviceType.SPICEVMC , org.ovirt.engine.core.bll.utils.VmDeviceUtils.getUsbSlotSpecParams ( ) , true , false , null ) ; } }

Target:
public static void addUsbSlots ( org.ovirt.engine.core.compat.Guid vmId , int numberOfSlots ) { for ( int index = 1 ; index <= numberOfSlots ; index ++ ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , vmId ) , VmDeviceGeneralType.REDIR , VmDeviceType.SPICEVMC , org.ovirt.engine.core.bll.utils.VmDeviceUtils.EMPTY_SPEC_PARAMS , true , false ) ; } }
Source:
public void postUpdateNumOfSockets2 ( ) { java.lang.String version = getClusterCompatibilityVersion ( ) . toString ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getMaxNumOfCPUsPerSocket ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.VmModelBehaviorBase behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.VmModelBehaviorBase ) ( target ) ) ; behavior.maxCpusPerSocket = ( ( java.lang.Integer ) ( returnValue ) ) ; behavior.totalCpuCoresChanged ( ) ; } } , getModel ( ) . getHash ( ) ) , version ) ; }

Target:
public void postUpdateNumOfSockets2 ( ) { java.lang.String version = getClusterCompatibilityVersion ( ) . toString ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getMaxNumOfCPUsPerSocket ( new org.ovirt.engine.ui.frontend.AsyncQuery ( getModel ( ) , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.VmModelBehaviorBase behavior = org.ovirt.engine.ui.uicommonweb.models.vms.VmModelBehaviorBase.this ; behavior.maxCpusPerSocket = ( ( java.lang.Integer ) ( returnValue ) ) ; behavior.totalCpuCoresChanged ( ) ; } } ) , version ) ; }
Source:
public void bondWithNetworkDidntChange ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond = createBond ( "net" ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ifaces = createBondSlaves ( bond.getName ( ) ) ; mockExistingIfacesWithBond ( bond , ifaces ) ; org.ovirt.engine.core.common.action.SetupNetworksParameters parameters = new org.ovirt.engine.core.common.action.SetupNetworksParameters ( ) ; ifaces.add ( bond ) ; parameters.setInterfaces ( ifaces ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( parameters ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNoBondsRemoved ( helper ) ; assertNoNetworksRemoved ( helper ) ; }

Target:
public void bondWithNoNetworkDidntChange ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond = createBond ( org.ovirt.engine.core.bll.SetupNetworksHelperTest.BOND_NAME , null ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ifaces = createNics ( bond.getName ( ) ) ; mockExistingIfacesWithBond ( bond , ifaces ) ; org.ovirt.engine.core.common.action.SetupNetworksParameters parameters = new org.ovirt.engine.core.common.action.SetupNetworksParameters ( ) ; ifaces.add ( bond ) ; parameters.setInterfaces ( ifaces ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( parameters ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNoBondsRemoved ( helper ) ; assertNoNetworksRemoved ( helper ) ; }
Source:
public void managementNetworkAttachmentInvalid ( ) throws java.lang.Exception { networkCluster.setRequired ( false ) ; org.junit.Assert.assertEquals ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.dal.VdcBllMessages.ACTION_TYPE_FAILED_MANAGEMENT_NETWORK_REQUIRED , org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorTest.NETWORK_NAME_REPLACEMENT ) , validator.managementNetworkAttachment ( org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorTest.NETWORK_NAME ) ) ; }

Target:
public void managementNetworkAttachmentInvalid ( ) throws java.lang.Exception { networkCluster.setRequired ( false ) ; org.junit.Assert.assertThat ( validator.managementNetworkAttachment ( org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorTest.NETWORK_NAME ) , org.junit.matchers.JUnitMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_MANAGEMENT_NETWORK_REQUIRED ) ) . and ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.replacements ( org.junit.matchers.JUnitMatchers.hasItem ( org.ovirt.engine.core.bll.network.cluster.NetworkClusterValidatorTest.NETWORK_NAME_REPLACEMENT ) ) ) ) ; }