auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public org.ovirt.engine.core.searchbackend.IConditionValueAutoCompleter getFieldValueAutoCompleter ( java.lang.String fieldName ) { if ( "OS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmOsType.class ) ; } else if ( "STATUS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VMStatus.class ) ; } else if ( "TYPE" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmType.class ) ; } return null ; }

Target:
public org.ovirt.engine.core.searchbackend.IConditionValueAutoCompleter getFieldValueAutoCompleter ( java.lang.String fieldName ) { if ( "OS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmOsType.class ) ; } else if ( "STATUS" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VMStatus.class ) ; } else if ( "TYPE" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.EnumValueAutoCompleter ( org.ovirt.engine.core.common.businessentities.VmType.class ) ; } else if ( "QUOTA" . equals ( fieldName ) ) { return new org.ovirt.engine.core.searchbackend.NullableStringAutoCompleter ( ) ; } return null ; }
Source:
protected void logRollbackedTask ( ) { java.lang.String type = ( ( getCurrentTaskHandler ( ) . getRevertTaskType ( ) ) != null ) ? getCurrentTaskHandler ( ) . getRevertTaskType ( ) . name ( ) : AsyncTaskType.unknown.name ( ) ; log.errorFormat ( "Reverting task {0}, handler: {1}" , type , getCurrentTaskHandler ( ) . getClass ( ) . getName ( ) ) ; }

Target:
protected void logRollbackedTask ( ) { java.lang.String type = ( ( getCurrentTaskHandler ( ) . getRevertTaskType ( ) ) != null ) ? getCurrentTaskHandler ( ) . getRevertTaskType ( ) . name ( ) : AsyncTaskType.unknown.name ( ) ; log.error ( "Reverting task '{}', handler '{}'" , type , getCurrentTaskHandler ( ) . getClass ( ) . getName ( ) ) ; }
Source:
public void testPersistentAuthDisabled ( ) { org.junit.Assert.assertFalse ( isPersistentAuth ( ) ) ; org.junit.Assert.assertFalse ( isPersistentAuth ( "x" , "y" ) ) ; org.junit.Assert.assertFalse ( isPersistentAuth ( "x" , "y" ) ) ; }

Target:
public void testPreferWithValue ( ) { org.junit.Assert.assertEquals ( FiltersHelper.PREFER_PERSISTENCE_AUTH , getPrefer ( "persistent-auth=false" ) ) ; org.junit.Assert.assertEquals ( FiltersHelper.PREFER_PERSISTENCE_AUTH , getPrefer ( "persistent-auth=true" ) ) ; org.junit.Assert.assertEquals ( FiltersHelper.PREFER_PERSISTENCE_AUTH , getPrefer ( "persistent-auth=junk" ) ) ; org.junit.Assert.assertEquals ( FiltersHelper.PREFER_NEW_AUTH , getPrefer ( "new-auth=false" ) ) ; org.junit.Assert.assertEquals ( ( ( FiltersHelper.PREFER_PERSISTENCE_AUTH ) | ( FiltersHelper.PREFER_NEW_AUTH ) ) , getPrefer ( "persistent-auth=false, new-auth=false" ) ) ; }
Source:
public void getRedirectServletReportsPage ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.String ) ( source ) ) : "" ; } } ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.RedirectServletReportsPage , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public void getHostNumaTopologyByHostId ( org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery , org.ovirt.engine.core.compat.Guid hostId ) { asyncQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VdsNumaNode > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVdsNumaNodesByVdsId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , asyncQuery ) ; }
Source:
public org.ovirt.engine.core.common.job.Job getJob ( final org.ovirt.engine.core.compat.Guid jobId ) { return org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < org.ovirt.engine.core.common.job.Job > ( ) { @ java.lang.Override public org.ovirt.engine.core.common.job.Job runInTransaction ( ) { org.ovirt.engine.core.common.job.Job job = jobDao.get ( jobId ) ; if ( job != null ) { job.getJobSubjectEntities ( ) ; } return job ; } } ) ; }

Target:
public org.ovirt.engine.core.common.job.Job getJob ( final org.ovirt.engine.core.compat.Guid jobId ) { org.ovirt.engine.core.common.job.Job job = jobDao.get ( jobId ) ; if ( job != null ) { java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.VdcObjectType > jobSubjectEntity = jobSubjectEntityDao.getJobSubjectEntityByJobId ( jobId ) ; job.setJobSubjectEntities ( jobSubjectEntity ) ; } return job ; }
Source:
public org.ovirt.engine.core.common.businessentities.VolumeFormat getDiskVolumeFormat ( org.ovirt.engine.core.common.businessentities.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { if ( storageType.isFileDomain ( ) ) { return org.ovirt.engine.core.common.businessentities.VolumeFormat.RAW ; } else if ( storageType.isBlockDomain ( ) ) { switch ( volumeType ) { case Sparse : return org.ovirt.engine.core.common.businessentities.VolumeFormat.COW ; case Preallocated : return org.ovirt.engine.core.common.businessentities.VolumeFormat.RAW ; default : return org.ovirt.engine.core.common.businessentities.VolumeFormat.Unassigned ; } } else { return org.ovirt.engine.core.common.businessentities.VolumeFormat.Unassigned ; } }

Target:
public org.ovirt.engine.core.common.businessentities.storage.VolumeFormat getDiskVolumeFormat ( org.ovirt.engine.core.common.businessentities.storage.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType ) { if ( storageType.isFileDomain ( ) ) { return org.ovirt.engine.core.common.businessentities.storage.VolumeFormat.RAW ; } else if ( storageType.isBlockDomain ( ) ) { switch ( volumeType ) { case Sparse : return org.ovirt.engine.core.common.businessentities.storage.VolumeFormat.COW ; case Preallocated : return org.ovirt.engine.core.common.businessentities.storage.VolumeFormat.RAW ; default : return org.ovirt.engine.core.common.businessentities.storage.VolumeFormat.Unassigned ; } } else { return org.ovirt.engine.core.common.businessentities.storage.VolumeFormat.Unassigned ; } }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getAddCommand ( ) ) ) { return popupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getAddParameterCommand ( ) ) ) { return addParameterPopupProvider.get ( ) ; } else if ( lastExecutedCommand == ( getModel ( ) . getEditParameterCommand ( ) ) ) { return editParameterPopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }
Source:
protected boolean canDoAction ( ) { boolean returnValue = ( ( ( ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkStoragePool ( ) ) && ( CheckStoragePoolStatusNotEqual ( StoragePoolStatus.Uninitialized , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL ) ) ) && ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkStorageDomain ( ) ) ) && ( storageDomainStatusIsValid ( ) ) ) && ( ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.getStorageDomain ( ) . getStorageDomainType ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainType.Master ) ) || ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkMasterDomainIsUp ( ) ) ) ) && ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkForActiveVds ( ) ) != null ) ; return returnValue ; }

Target:
protected boolean canDoAction ( ) { boolean returnValue = ( ( ( ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkStoragePool ( ) ) && ( checkStoragePoolStatusNotEqual ( StoragePoolStatus.Uninitialized , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL ) ) ) && ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkStorageDomain ( ) ) ) && ( storageDomainStatusIsValid ( ) ) ) && ( ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.getStorageDomain ( ) . getStorageDomainType ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainType.Master ) ) || ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkMasterDomainIsUp ( ) ) ) ) && ( ( org.ovirt.engine.core.bll.storage.ActivateStorageDomainCommand.checkForActiveVds ( ) ) != null ) ; return returnValue ; }
Source:
public void testGetBaseNicWhenCacheIsNotProvided ( ) throws java.lang.Exception { org.mockito.Mockito.when ( interfaceDao.get ( baseNic.getVdsId ( ) , baseNic.getName ( ) ) ) . thenReturn ( baseNic ) ; org.junit.Assert.assertThat ( calculateBaseNic.getBaseNic ( vlanNic , null ) , org.hamcrest.CoreMatchers.is ( baseNic ) ) ; org.mockito.Mockito.verify ( interfaceDao ) . get ( org.mockito.Matchers.eq ( baseNic.getVdsId ( ) ) , org.mockito.Matchers.eq ( baseNic.getName ( ) ) ) ; org.mockito.Mockito.verifyNoMoreInteractions ( interfaceDao ) ; }

Target:
public void testGetBaseNicWhenCacheIsNotProvided ( ) throws java.lang.Exception { org.mockito.Mockito.when ( interfaceDao.get ( baseNic.getVdsId ( ) , baseNic.getName ( ) ) ) . thenReturn ( baseNic ) ; org.junit.Assert.assertThat ( calculateBaseNic.getBaseNic ( vlanNic , null ) , org.hamcrest.CoreMatchers.is ( baseNic ) ) ; org.mockito.Mockito.verify ( interfaceDao ) . get ( org.mockito.ArgumentMatchers.eq ( baseNic.getVdsId ( ) ) , org.mockito.ArgumentMatchers.eq ( baseNic.getName ( ) ) ) ; org.mockito.Mockito.verifyNoMoreInteractions ( interfaceDao ) ; }
Source:
public static void getClusterById ( 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.RunQuery ( VdcQueryType.GetVdsGroupById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }

Target:
public static void getClusterDesktopMemoryOverCommit ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxVdsMemOverCommit , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
public static 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.RunQuery ( VdcQueryType.GetGlusterHookContent , parameters , aQuery ) ; }

Target:
public static void getHostPublicKey ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetServerSSHPublicKey , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
public void testMigrateMacsToAnotherMacPool ( ) throws java.lang.Exception { underTest.migrateMacsToAnotherMacPool ( sourceMacPoolId , targetMacPoolId , macsToMigrate , false , commandContext ) ; org.mockito.Mockito.verify ( macPoolPerCluster ) . getMacPoolById ( sourceMacPoolId , commandContext ) ; org.mockito.Mockito.verify ( macPoolPerCluster ) . getMacPoolById ( targetMacPoolId , commandContext ) ; org.mockito.InOrder inOrder = org.mockito.Mockito.inOrder ( sourceMacPool , targetMacPool ) ; inOrder.verify ( sourceMacPool ) . freeMacs ( macsToMigrate ) ; inOrder.verify ( targetMacPool ) . forceAddMacs ( macsToMigrate ) ; }

Target:
public void testMigrateMacsToAnotherMacPoolWithSuccessfulDuplicityCheck ( ) { underTest.migrateMacsToAnotherMacPool ( sourceMacPoolId , targetMacPoolId , macsToMigrate , commandContext ) ; org.mockito.Mockito.verify ( macPoolPerCluster ) . getMacPoolById ( sourceMacPoolId , commandContext ) ; org.mockito.Mockito.verify ( macPoolPerCluster ) . getMacPoolById ( targetMacPoolId , commandContext ) ; org.mockito.InOrder inOrder = org.mockito.Mockito.inOrder ( sourceMacPool , targetMacPool ) ; inOrder.verify ( sourceMacPool ) . freeMacs ( macsToMigrate ) ; inOrder.verify ( targetMacPool ) . addMacs ( macsToMigrate ) ; }
Source:
public void canDoActionVmIsNotDown ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( ) ; initVmForFail ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( ) ; org.mockito.Mockito.doReturn ( vmDeviceDao ) . when ( command ) . getVmDeviceDAO ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN.toString ( ) ) ) ; }

Target:
public void canDoActionVmIsNotDown ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( ) ; initVmForFail ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( ) ; org.mockito.Mockito.doReturn ( vmDeviceDao ) . when ( command ) . getVmDeviceDAO ( ) ; org.mockito.Mockito.doReturn ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ) . when ( command ) . getAllImageSnapshots ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN.toString ( ) ) ) ; }
Source:
private void DefaultHost_SelectedItemChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { behavior.DefaultHost_SelectedItemChanged ( ) ; }

Target:
private void WatchdogModel_EntityChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { if ( "" . equals ( getWatchdogModel ( ) . getEntity ( ) ) ) { getWatchdogAction ( ) . setIsChangable ( false ) ; getWatchdogAction ( ) . setSelectedItem ( "" ) ; } else { getWatchdogAction ( ) . setIsChangable ( true ) ; } }
Source:
public void getStorageDomainDefaultWipeAfterDelete ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter < java.lang.Boolean > ( ) { @ java.lang.Override public java.lang.Boolean convert ( java.lang.Object returnValue , org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery ) { return ( ( java.lang.Boolean ) ( returnValue ) ) ; } } ; org.ovirt.engine.core.common.queries.GetStorageDomainDefaultWipeAfterDeleteParameters params = new org.ovirt.engine.core.common.queries.GetStorageDomainDefaultWipeAfterDeleteParameters ( storageType ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainDefaultWipeAfterDelete , params , aQuery ) ; }

Target:
public void getAncestorImagesByImagesIds ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.util.List < org.ovirt.engine.core.compat.Guid > imagesIds ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter < java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.storage.DiskImage > > ( ) { @ java.lang.Override public java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.storage.DiskImage > convert ( java.lang.Object returnValue , org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery ) { return ( ( java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.storage.DiskImage > ) ( returnValue ) ) ; } } ; org.ovirt.engine.core.common.queries.IdsQueryParameters params = new org.ovirt.engine.core.common.queries.IdsQueryParameters ( imagesIds ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAncestorImagesByImagesIds , params , aQuery ) ; }
Source:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel object ) { super . edit ( object ) ; initTabAvailabilityListeners ( object ) ; if ( object.isVmAttachedToPool ( ) ) { specificHost.setEnabled ( false ) ; customPropertiesSheetEditor.setEnabled ( false ) ; } }

Target:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel object ) { super . edit ( object ) ; initTabAvailabilityListeners ( object ) ; if ( object.isVmAttachedToPool ( ) ) { specificHost.setEnabled ( false ) ; specificHostLabel.setStyleName ( style.labelDisabled ( ) , true ) ; customPropertiesSheetEditor.setEnabled ( false ) ; } }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.Provider > getBackendCollection ( ) { if ( isFiltered ( ) ) { return getBackendCollection ( VdcQueryType.GetAllProviders , new org.ovirt.engine.core.common.queries.GetAllProvidersParameters ( org.ovirt.engine.core.common.businessentities.ProviderType.OPENSTACK_NETWORK ) ) ; } else { return getBackendCollection ( SearchType.Provider , getConstraint ( ) ) ; } }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.Provider > getBackendCollection ( ) { if ( isFiltered ( ) ) { return getBackendCollection ( VdcQueryType.GetAllProviders , new org.ovirt.engine.core.common.queries.GetAllProvidersParameters ( org.ovirt.engine.core.common.businessentities.ProviderType.OPENSTACK_NETWORK , org.ovirt.engine.core.common.businessentities.ProviderType.EXTERNAL_NETWORK ) ) ; } else { java.util.List < org.ovirt.engine.core.common.businessentities.Provider > openstackCollection = getBackendCollection ( SearchType.Provider , getConstraint ( ProviderType.OPENSTACK_NETWORK.name ( ) ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Provider > externalCollection = getBackendCollection ( SearchType.Provider , getConstraint ( ProviderType.EXTERNAL_NETWORK.name ( ) ) ) ; openstackCollection.addAll ( externalCollection ) ; return openstackCollection ; } }
Source:
public void canDoActionPreallocatedSpaceCheckSucceeds ( ) { final int availableSize = 12 ; final int usedSize = 8 ; org.ovirt.engine.core.compat.Guid sdid = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; initializeCommand ( sdid , VolumeType.Preallocated ) ; mockVm ( ) ; mockStorageDomain ( sdid , availableSize , usedSize ) ; mockStoragePoolIsoMap ( ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }

Target:
protected void mockInterfaceList ( ) { org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; java.util.ArrayList < java.lang.String > diskInterfaces = new java.util.ArrayList < java.lang.String > ( java.util.Arrays.asList ( new java.lang.String [ ] { "IDE" , "VirtIO" , "VirtIO_SCSI" } ) ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.mockito.Matchers.anyInt ( ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( diskInterfaces ) ; }
Source:
public void testGetAllForNetworkHasNoPermission ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VnicProfile > result = dao.getAllForNetwork ( FixturesTool.NETWORK_ENGINE , org.ovirt.engine.core.dao.network.VnicProfileDaoTest.UNPRIVILEGED_USER_ID , true ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertTrue ( result.isEmpty ( ) ) ; }

Target:
public void testUpdate ( ) { dao.save ( vnicProfile ) ; vnicProfile.setPortMirroring ( true ) ; dao.update ( vnicProfile ) ; org.ovirt.engine.core.common.businessentities.network.VnicProfile result = dao.get ( vnicProfile.getId ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( vnicProfile.getId ( ) , result.getId ( ) ) ; org.junit.Assert.assertEquals ( true , result.isPortMirroring ( ) ) ; }
Source:
private void addNetworkPostData ( ) { if ( ( nics ) == null ) { return ; } org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceModel model = org.ovirt.engine.ui.uicommonweb.models.vms.NewVmInterfaceModel.createInstance ( getEntity ( ) . getStaticData ( ) , getEntity ( ) . getStoragePoolId ( ) , getEntity ( ) . getVdsGroupCompatibilityVersion ( ) , nics , this ) ; setWindow ( model ) ; stopProgress ( ) ; }

Target:
private void addNetworkPostData ( ) { if ( ( nics ) == null ) { return ; } org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceModel model = org.ovirt.engine.ui.uicommonweb.models.vms.NewGuideVmInterfaceModel.createInstance ( getEntity ( ) . getStaticData ( ) , getEntity ( ) . getStoragePoolId ( ) , getEntity ( ) . getVdsGroupCompatibilityVersion ( ) , nics , this ) ; setWindow ( model ) ; stopProgress ( ) ; }
Source:
protected org.ovirt.engine.api.model.VM deprecatedPopulate ( org.ovirt.engine.api.model.VM model , org.ovirt.engine.api.model.VM entity ) { java.util.Set < java.lang.String > details = org.ovirt.engine.api.common.util.DetailHelper.getDetails ( httpHeaders , uriInfo ) ; parent.addInlineDetails ( details , model ) ; if ( details.contains ( "statistics" ) ) { addStatistics ( model , entity , uriInfo ) ; } parent.setPayload ( model ) ; parent.setBallooning ( model ) ; parent.setCertificateInfo ( model ) ; return model ; }

Target:
protected org.ovirt.engine.api.model.Vm deprecatedPopulate ( org.ovirt.engine.api.model.Vm model , org.ovirt.engine.api.restapi.resource.VM entity ) { java.util.Set < java.lang.String > details = org.ovirt.engine.api.common.util.DetailHelper.getDetails ( httpHeaders , uriInfo ) ; parent.addInlineDetails ( details , model ) ; if ( details.contains ( "statistics" ) ) { addStatistics ( model , entity , uriInfo ) ; } parent.setPayload ( model ) ; parent.setBallooning ( model ) ; parent.setCertificateInfo ( model ) ; return model ; }
Source:
public void testValidateFieldValueWithTime ( ) { org.ovirt.engine.core.searchbackend.IConditionFieldAutoCompleter comp = new org.ovirt.engine.core.searchbackend.AuditLogConditionFieldAutoCompleter ( ) ; java.lang.String dateString = "01/12/1972" ; assertTrue ( dateString , comp.validateFieldValue ( "TIME" , dateString ) ) ; assertFalse ( "SOME_RANDOM_TEXT" , comp.validateFieldValue ( "TIME" , "SOME_RANDOM_TEXT" ) ) ; }

Target:
public void testValidateFieldValueWithTime ( ) { org.ovirt.engine.core.searchbackend.IConditionFieldAutoCompleter comp = new org.ovirt.engine.core.searchbackend.AuditLogConditionFieldAutoCompleter ( ) ; java.lang.String dateString = "01/12/1972" ; org.junit.Assert.assertTrue ( dateString , comp.validateFieldValue ( "TIME" , dateString ) ) ; org.junit.Assert.assertFalse ( "SOME_RANDOM_TEXT" , comp.validateFieldValue ( "TIME" , "SOME_RANDOM_TEXT" ) ) ; }
Source:
public void checkAndRemoveVolumeSnapshotLimitsAlert ( final org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume ) { if ( ! ( glusterDBUtils.isVolumeSnapshotSoftLimitReached ( volume.getId ( ) ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AlertDirector.removeVolumeAlert ( volume.getId ( ) , AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED ) ; } if ( ! ( glusterDBUtils.isVolumeSnapshotHardLimitReached ( volume.getId ( ) ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AlertDirector.removeVolumeAlert ( volume.getId ( ) , AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED ) ; } }

Target:
public void checkAndRemoveVolumeSnapshotLimitsAlert ( final org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volume ) { if ( ! ( glusterDBUtils.isVolumeSnapshotSoftLimitReached ( volume.getId ( ) ) ) ) { alertDirector.removeVolumeAlert ( volume.getId ( ) , AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED ) ; } if ( ! ( glusterDBUtils.isVolumeSnapshotHardLimitReached ( volume.getId ( ) ) ) ) { alertDirector.removeVolumeAlert ( volume.getId ( ) , AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED ) ; } }
Source:
public void getClusterGlusterServices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters parameters = new org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters ( clusterId , null , null , false ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeAdvancedDetails , parameters , aQuery ) ; }

Target:
public void getClusterDesktopMemoryOverCommit ( org.ovirt.engine.ui.frontend.AsyncQuery < java.lang.Integer > aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.DefaultValueConverter < > ( 0 ) ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxVdsMemOverCommit , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
public void testAlreadyExistStorageDomain ( ) { org.mockito.Mockito.when ( command.getStorageDomainStaticDAO ( ) . get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.storage.AddExistingBlockStorageDomainCommandTest.getStorageDomain ( ) ) ; org.junit.Assert.assertFalse ( "Storage Domain already exists" , command.canAddDomain ( ) ) ; org.junit.Assert.assertTrue ( "Import block Storage Domain should have failed due to already existing Storage Domain" , command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST.toString ( ) ) ) ; }

Target:
public void testAlreadyExistStorageDomain ( ) { org.mockito.Mockito.when ( command.getStorageDomainStaticDao ( ) . get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.storage.AddExistingBlockStorageDomainCommandTest.getStorageDomain ( ) ) ; org.junit.Assert.assertFalse ( "Storage Domain already exists" , command.canAddDomain ( ) ) ; org.junit.Assert.assertTrue ( "Import block Storage Domain should have failed due to already existing Storage Domain" , command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST.toString ( ) ) ) ; }
Source:
public static boolean CanUpdateField ( java.lang.String objectType , java.lang.String fieldName , java.lang.Enum < ? > status , java.lang.Object fieldContainer ) { java.lang.Class < ? > type = org.ovirt.engine.core.utils.ObjectIdentityChecker.aliases.get ( objectType ) ; if ( type != null ) { return org.ovirt.engine.core.utils.ObjectIdentityChecker.CanUpdateField ( type , fieldName , status , fieldContainer ) ; } else { throw new java.lang.RuntimeException ( java.lang.String.format ( "status type %1$s not exist" , type ) ) ; } }

Target:
public static boolean CanUpdateField ( java.lang.String objectType , java.lang.String fieldName , java.lang.Enum < ? > status , java.lang.Object fieldContainer ) { java.lang.Class < ? > type = org.ovirt.engine.core.utils.ObjectIdentityChecker.aliases.get ( objectType ) ; if ( type != null ) { return org.ovirt.engine.core.utils.ObjectIdentityChecker.CanUpdateField ( type , fieldName , status , fieldContainer ) ; } else { throw new java.lang.RuntimeException ( "status type [null] not exist" ) ; } }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemModel lastSelectedItem = modelProvider.getSelectionModel ( ) . getSelectedObject ( ) ; modelProvider.getSelectionModel ( ) . setSelected ( lastSelectedItem , false ) ; expandTree ( getDataDisplayWidget ( ) . getRootTreeNode ( ) , org.ovirt.engine.ui.webadmin.widget.tree.SystemTree.ITEM_LEVEL ) ; }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { expandPath ( modelProvider.getSelectionModel ( ) . getSelectedObject ( ) ) ; }
Source:
public void testCannotDisableVirtioScsi ( ) { prepareVmToPassCanDoAction ( ) ; command.getParameters ( ) . setVirtioScsiEnabled ( false ) ; org.ovirt.engine.core.common.businessentities.storage.Disk disk = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; disk.setDiskInterface ( DiskInterface.VirtIO_SCSI ) ; disk.setPlugged ( true ) ; mockDiskDaoGetAllForVm ( java.util.Collections.singletonList ( disk ) , true ) ; mockVmValidator ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS ) ; }

Target:
public void testCannotDisableVirtioScsi ( ) { prepareVmToPassCanDoAction ( ) ; command.getParameters ( ) . setVirtioScsiEnabled ( false ) ; org.ovirt.engine.core.common.businessentities.storage.Disk disk = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; disk.setDiskInterface ( DiskInterface.VirtIO_SCSI ) ; disk.setPlugged ( true ) ; mockDiskDaoGetAllForVm ( java.util.Collections.singletonList ( disk ) , true ) ; mockVmValidator ( ) ; command.initEffectiveCompatibilityVersion ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterVolumeSnapshotDelete ( java.lang.String volumeName ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterVolumeSnapshotDelete ( volumeName ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeGeoRepConfigListXmlRpc glusterVolumeGeoRepConfigList ( java.lang.String volumeName , java.lang.String slaveHost , java.lang.String slaveVolumeName , java.lang.String userName ) { try { return new org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeGeoRepConfigListXmlRpc ( vdsServer.glusterVolumeGeoRepConfigList ( volumeName , slaveHost , slaveVolumeName , userName ) ) ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } if ( ( getGeoRepSession ( ) . getStatus ( ) . equals ( GeoRepSessionStatus.ACTIVE ) ) && ( ! ( getParameters ( ) . isForce ( ) ) ) ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_STARTED ) ; } return true ; }

Target:
protected boolean validate ( ) { if ( ! ( super . validate ( ) ) ) { return false ; } if ( ( getGeoRepSession ( ) . getStatus ( ) . equals ( GeoRepSessionStatus.ACTIVE ) ) && ( ! ( getParameters ( ) . isForce ( ) ) ) ) { return failValidation ( EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_STARTED ) ; } return true ; }
Source:
public void Cancel ( ) { CancelConfirmation ( ) ; setGuideContext ( null ) ; setWindow ( null ) ; UpdateActionAvailability ( ) ; }

Target:
public void onForceRemove ( ) { org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel ) ( getWindow ( ) ) ) ; if ( ! ( model.validate ( ) ) ) { return ; } org.ovirt.engine.core.common.action.VdcActionParametersBase parametersBase = new org.ovirt.engine.core.common.action.VdcActionParametersBase ( ) ; org.ovirt.engine.core.common.action.StoragePoolParametersBase tempVar = new org.ovirt.engine.core.common.action.StoragePoolParametersBase ( ( ( org.ovirt.engine.core.common.businessentities.StoragePool ) ( getSelectedItem ( ) ) ) . getId ( ) ) ; tempVar.setForceDelete ( true ) ; parametersBase = tempVar ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.RemoveStoragePool , parametersBase ) ; cancel ( ) ; }
Source:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { org.ovirt.engine.core.common.action.VmManagementParametersBase param = new org.ovirt.engine.core.common.action.VmManagementParametersBase ( gettempVm ( ) ) ; param.setSoundDeviceEnabled ( ( ( java.lang.Boolean ) ( model.getIsSoundcardEnabled ( ) . getEntity ( ) ) ) ) ; param.setConsoleEnabled ( ( ( java.lang.Boolean ) ( model.getIsConsoleDeviceEnabled ( ) . getEntity ( ) ) ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.UpdateVm , param , new org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallbacks.NetworkUpdateFrontendAsyncCallback ( model , defaultNetworkCreatingManager , gettempVm ( ) . getId ( ) ) , this ) ; }

Target:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { org.ovirt.engine.core.common.action.VmManagementParametersBase param = new org.ovirt.engine.core.common.action.VmManagementParametersBase ( gettempVm ( ) ) ; param.setSoundDeviceEnabled ( model.getIsSoundcardEnabled ( ) . getEntity ( ) ) ; param.setConsoleEnabled ( model.getIsConsoleDeviceEnabled ( ) . getEntity ( ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.UpdateVm , param , new org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback ( model , defaultNetworkCreatingManager , gettempVm ( ) . getId ( ) ) , this ) ; }
Source:
public void testRemove ( ) throws java.lang.Exception { setUpVDSGroupExpectations ( org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID ) ; setUpEntityQueryExpectations ( 2 , false , false , false ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.DetachNetworkToVdsGroup , org.ovirt.engine.core.common.action.AttachNetworkToVdsGroupParameter.class , new java.lang.String [ ] { "VdsGroupId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID } , true , true ) ) ; verifyRemove ( resource.remove ( ) ) ; }

Target:
public void testRemove ( ) throws java.lang.Exception { setUpClusterExpectations ( org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID ) ; setUpEntityQueryExpectations ( 2 , false , false , false ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.DetachNetworkToCluster , org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter.class , new java.lang.String [ ] { "ClusterId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID } , true , true ) ) ; verifyRemove ( resource.remove ( ) ) ; }
Source:
private java.lang.String getTimeZoneForVm ( org.ovirt.engine.core.common.businessentities.VM vm ) { if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( vm.getTimeZone ( ) ) ) ) { return vm.getTimeZone ( ) ; } if ( OsRepositoryImpl.INSTANCE.isWindows ( vm.getOs ( ) ) ) { return org.ovirt.engine.core.common.config.Config.< java.lang.String > GetValue ( ConfigValues.DefaultWindowsTimeZone ) ; } else { return "Etc/GMT" ; } }

Target:
private java.lang.String getTimeZoneForVm ( org.ovirt.engine.core.common.businessentities.VM vm ) { if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( vm.getTimeZone ( ) ) ) ) { return vm.getTimeZone ( ) ; } if ( osRepository.isWindows ( vm.getOs ( ) ) ) { return org.ovirt.engine.core.common.config.Config.< java.lang.String > GetValue ( ConfigValues.DefaultWindowsTimeZone ) ; } else { return "Etc/GMT" ; } }
Source:
public org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails getNetworkImplementationDetails ( ) { if ( ! ( isAttached ( ) ) ) { return null ; } org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = ( hasVlan ( ) ) ? getVlanNicModel ( ) . getIface ( ) : getAttachedToNic ( ) . getIface ( ) ; return nic.getNetworkImplementationDetails ( ) ; }

Target:
public boolean isInSync ( ) { org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations reportedConfigurations = getReportedConfigurations ( ) ; return ( reportedConfigurations == null ) || ( reportedConfigurations.isNetworkInSync ( ) ) ; }
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.AuditLog event = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAuditLogDao ( ) . get ( org.ovirt.engine.core.bll.RemoveExternalEventCommand.getParameters ( ) . getId ( ) ) ; if ( event == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND ) ; } if ( OVIRT.equalsIgnoreCase ( event.getOrigin ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN ) ; } if ( ( event.getseverity ( ) ) == ( org.ovirt.engine.core.common.AuditLogSeverity.ALERT ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_OPERATION ) ; } return true ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.AuditLog event = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAuditLogDao ( ) . get ( org.ovirt.engine.core.bll.RemoveExternalEventCommand.getParameters ( ) . getId ( ) ) ; if ( event == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND ) ; } if ( org.ovirt.engine.core.bll.RemoveExternalEventCommand.OVIRT.equalsIgnoreCase ( event.getOrigin ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN ) ; } if ( ( event.getseverity ( ) ) == ( org.ovirt.engine.core.common.AuditLogSeverity.ALERT ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_OPERATION ) ; } return true ; }
Source:
public void qosOnInterface ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = createNetwork ( null ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNic ( "eth0" , null , null , network.getName ( ) ) ; org.ovirt.engine.core.common.businessentities.network.NetworkQoS qos = createQos ( ) ; iface.setQos ( qos ) ; iface.setQosOverridden ( true ) ; org.mockito.Mockito.when ( qosDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( createQos ( ) ) ; qos ( network , iface , qos , true ) ; }

Target:
public void qosOnInterface ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = createNetwork ( null ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNic ( "eth0" , null , null , network.getName ( ) ) ; org.ovirt.engine.core.common.businessentities.network.HostNetworkQos qos = createQos ( ) ; iface.setQos ( qos ) ; iface.setQosOverridden ( true ) ; org.mockito.Mockito.when ( qosDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( createQos ( ) ) ; qos ( network , iface , qos , true ) ; }
Source:
private void mockGraphicsDevices ( org.ovirt.engine.core.compat.Guid vmId ) { org.ovirt.engine.core.common.businessentities.VmDevice graphicsDevice = new org.ovirt.engine.core.common.businessentities.GraphicsDevice ( org.ovirt.engine.core.common.utils.VmDeviceType.SPICE ) ; graphicsDevice.setDeviceId ( Guid.Empty ) ; graphicsDevice.setVmId ( vmId ) ; org.mockito.Mockito.when ( deviceDao.getVmDeviceByVmIdAndType ( vmId , VmDeviceGeneralType.GRAPHICS ) ) . thenReturn ( java.util.Arrays.asList ( graphicsDevice ) ) ; org.mockito.Mockito.doReturn ( deviceDao ) . when ( dbFacade ) . getVmDeviceDao ( ) ; }

Target:
public void InitTest ( ) { mockOsRepository ( ) ; org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.dal.dbbroker.DbFacade.class , dbFacade ) ; org.mockito.Mockito.doReturn ( deviceDao ) . when ( dbFacade ) . getVmDeviceDao ( ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.init ( ) ; }
Source:
private org.ovirt.engine.core.common.action.VdcActionParametersBase setReinitializeSysPrep ( org.ovirt.engine.core.common.action.RunVmOnceParams params ) { org.ovirt.engine.api.model.VM vm = getEntity ( org.ovirt.engine.api.model.VM.class , VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.GetVmByVmIdParameters ( guid ) , "VM" ) ; if ( ( vm.getvm_os ( ) . isWindows ( ) ) && ( vm.getIsFirstRun ( ) ) ) { params.setReinitialize ( true ) ; } return params ; }

Target:
private org.ovirt.engine.core.common.action.VdcActionParametersBase setReinitializeSysPrep ( org.ovirt.engine.core.common.action.RunVmOnceParams params ) { org.ovirt.engine.api.model.VM vm = getEntity ( org.ovirt.engine.api.model.VM.class , VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.GetVmByVmIdParameters ( guid ) , "VM" ) ; if ( ( vm.getVmOs ( ) . isWindows ( ) ) && ( vm.getIsFirstRun ( ) ) ) { params.setReinitialize ( true ) ; } return params ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > pools = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( returnValue ) ) ; org.ovirt.engine.core.common.businessentities.StoragePool pool = pools.get ( 0 ) ; if ( pool != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetStorageDomainList ( ( ( org.ovirt.engine.ui.frontend.AsyncQuery ) ( model ) ) , pool.getId ( ) ) ; } }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > pools = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( returnValue ) ) ; org.ovirt.engine.core.common.businessentities.StoragePool pool = pools.get ( 0 ) ; if ( pool != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getStorageDomainList ( ( ( org.ovirt.engine.ui.frontend.AsyncQuery ) ( model ) ) , pool.getId ( ) ) ; } }
Source:
public static void isSoundcardEnabled ( 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 ( ( ( java.util.List < java.lang.String > ) ( source ) ) . size ( ) ) > 0 ; } return false ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetSoundDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }

Target:
public static void getSpiceUsbAutoShare ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SpiceUsbAutoShare , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
private static void AddGroupToUser ( org.ovirt.engine.core.common.businessentities.AdUser user , java.lang.String groupName ) { if ( ! ( user.getGroups ( ) . containsKey ( groupName ) ) ) { org.ovirt.engine.core.common.businessentities.ad_groups group = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAdGroupDAO ( ) . getByName ( groupName ) ; if ( group != null ) { user.getGroups ( ) . put ( groupName , group ) ; } else { user.getGroups ( ) . put ( groupName , new org.ovirt.engine.core.common.businessentities.ad_groups ( ) ) ; } } }

Target:
private static void AddGroupToUser ( org.ovirt.engine.core.common.businessentities.AdUser user , java.lang.String groupName ) { if ( ! ( user.getGroups ( ) . containsKey ( groupName ) ) ) { org.ovirt.engine.core.common.businessentities.ad_groups group = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAdGroupDao ( ) . getByName ( groupName ) ; if ( group != null ) { user.getGroups ( ) . put ( groupName , group ) ; } else { user.getGroups ( ) . put ( groupName , new org.ovirt.engine.core.common.businessentities.ad_groups ( ) ) ; } } }
Source:
public void remove ( T key ) { org.ovirt.engine.core.bll.network.macpoolmanager.ObjectCounter.Counter counter = map.get ( key ) ; if ( counter == null ) { return ; } int count = counter.decrement ( ) ; if ( count == 0 ) { map.remove ( key ) ; } else if ( count < 0 ) { throw new java.lang.IllegalStateException ( "count underflow." ) ; } }

Target:
public void decrease ( T key ) { org.ovirt.engine.core.bll.network.macpoolmanager.ObjectCounter.Counter counter = map.get ( key ) ; if ( counter == null ) { return ; } int count = counter.decrease ( ) ; if ( count == 0 ) { map.remove ( key ) ; } else if ( count < 0 ) { throw new java.lang.IllegalStateException ( "count underflow." ) ; } }