auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public javax.ws.rs.core.Response remove ( ) { get ( ) ; boolean force = org.ovirt.engine.api.common.util.QueryHelper.getBooleanMatrixParameter ( uriInfo , org.ovirt.engine.api.restapi.resource.BackendVmResource.FORCE , true , false ) ; org.ovirt.engine.core.common.action.RemoveVmParameters params = new org.ovirt.engine.core.common.action.RemoveVmParameters ( guid , force ) ; boolean detachOnly = org.ovirt.engine.api.common.util.QueryHelper.getBooleanMatrixParameter ( uriInfo , org.ovirt.engine.api.restapi.resource.BackendVmResource.DETACH_ONLY , true , false ) ; if ( detachOnly ) { params.setRemoveDisks ( false ) ; } return performAction ( VdcActionType.RemoveVm , params ) ; }

Target:
public javax.ws.rs.core.Response remove ( ) { get ( ) ; boolean force = org.ovirt.engine.api.common.util.ParametersHelper.getBooleanParameter ( httpHeaders , uriInfo , org.ovirt.engine.api.restapi.resource.BackendVmResource.FORCE , true , false ) ; org.ovirt.engine.core.common.action.RemoveVmParameters params = new org.ovirt.engine.core.common.action.RemoveVmParameters ( guid , force ) ; boolean detachOnly = org.ovirt.engine.api.common.util.ParametersHelper.getBooleanParameter ( httpHeaders , uriInfo , org.ovirt.engine.api.restapi.resource.BackendVmResource.DETACH_ONLY , true , false ) ; if ( detachOnly ) { params.setRemoveDisks ( false ) ; } return performAction ( VdcActionType.RemoveVm , params ) ; }
Source:
private static org.ovirt.engine.core.common.businessentities.VDSGroup createDefaultVdsGroup ( ) { org.ovirt.engine.core.common.businessentities.VDSGroup group = new org.ovirt.engine.core.common.businessentities.VDSGroup ( ) ; group.setname ( "Default" ) ; group.setId ( VDSGroup.DEFAULT_VDS_GROUP_ID ) ; group.setcpu_name ( "Intel Conroe" ) ; group.setcompatibility_version ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.VERSION_1_1 ) ; group.setstorage_pool_id ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.STORAGE_POOL_ID ) ; return group ; }

Target:
private static org.ovirt.engine.core.common.businessentities.VDSGroup createDefaultVdsGroup ( ) { org.ovirt.engine.core.common.businessentities.VDSGroup group = new org.ovirt.engine.core.common.businessentities.VDSGroup ( ) ; group.setname ( "Default" ) ; group.setId ( VDSGroup.DEFAULT_VDS_GROUP_ID ) ; group.setcpu_name ( "Intel Conroe" ) ; group.setcompatibility_version ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.VERSION_1_1 ) ; group.setStoragePoolId ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.STORAGE_POOL_ID ) ; return group ; }
Source:
public void executeCommandWhenServerIdPresent ( ) { setUpMocksForUpdate ( ) ; mockForReadContent ( true , null ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.times ( 1 ) ) . updateGlusterHook ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_UPDATED , cmd.getAuditLogTypeValue ( ) ) ; }

Target:
public void executeCommandWhenServerIdPresent ( ) { setUpMocksForUpdate ( ) ; mockForReadContent ( true , null ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.times ( 1 ) ) . updateGlusterHook ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( AuditLogType.GLUSTER_HOOK_UPDATED , cmd.getAuditLogTypeValue ( ) ) ; }
Source:
protected void analyze ( ) { proceedDownVms ( ) ; proceedWatchdogEvents ( ) ; proceedBalloonCheck ( ) ; proceedGuaranteedMemoryCheck ( ) ; updateRepository ( ) ; prepareGuestAgentNetworkDevicesForUpdate ( ) ; updateLunDisks ( ) ; updateVmJobs ( ) ; analyzeExternalVms ( ) ; analyzeHostedEngineVm ( ) ; if ( ( vmDynamicToSave ) != null ) { vmsMonitoring.addVmDynamicToList ( vmDynamicToSave ) ; } if ( saveStatistics ) { vmsMonitoring.addVmStatisticsToList ( dbVm.getStatisticsData ( ) ) ; } if ( saveVmInterfaces ) { vmsMonitoring.addVmInterfaceStatisticsToList ( dbVm.getInterfaces ( ) ) ; } }

Target:
public org.ovirt.engine.core.common.businessentities.VmStatistics getVmStatisticsToSave ( ) { return saveStatistics ? dbVm.getStatisticsData ( ) : null ; }
Source:
private void doTestIpConfiguredForStaticBootProtocolWhenIpConfigurationIsNotNullForBootProtocol ( org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol bootProtocol ) { org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachmentWithIpConfiguration = createNetworkAttachmentWithIpConfiguration ( bootProtocol , null , null ) ; org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator networkAttachmentValidator = createNetworkAttachmentValidator ( networkAttachmentWithIpConfiguration ) ; org.junit.Assert.assertThat ( networkAttachmentValidator.ipConfiguredForStaticBootProtocol ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void testNetworkExistWhenOnlyNetworkNameIsSet ( ) { java.lang.String networkName = "network" ; org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment = new org.ovirt.engine.core.common.businessentities.network.NetworkAttachment ( ) ; networkAttachment.setNetworkName ( networkName ) ; org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator validator = createNetworkAttachmentValidator ( networkAttachment ) ; org.ovirt.engine.core.common.errors.EngineMessage engineMessage = org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_HAVING_NAME_NOT_EXISTS ; org.junit.Assert.assertThat ( validator.networkExists ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( engineMessage , org.ovirt.engine.core.utils.ReplacementUtils.getVariableAssignmentString ( engineMessage , networkName ) ) ) ; }
Source:
protected java.lang.String getColumnWidthKey ( com.google.gwt.user.cellview.client.Column < T , ? > column ) { if ( columnResizePersistenceEnabled ) { return ( ( ( ( org.ovirt.engine.ui.common.widget.table.ColumnResizeCellTable.GRID_COLUMN_WIDTH_PREFIX ) + "_" ) + ( getGridElementId ( ) ) ) + "_" ) + ( determineOriginalIndex ( getColumnIndex ( column ) ) ) ; } return null ; }

Target:
protected java.lang.String getHiddenColumnWidthKey ( com.google.gwt.user.cellview.client.Column < T , ? > column ) { if ( columnResizePersistenceEnabled ) { return ( ( ( ( ( ( org.ovirt.engine.ui.common.widget.table.ColumnResizeCellTable.GRID_HIDDEN ) + "_" ) + ( org.ovirt.engine.ui.common.widget.table.ColumnResizeCellTable.GRID_COLUMN_WIDTH_PREFIX ) ) + "_" ) + ( getGridElementId ( ) ) ) + "_" ) + ( getColumnIndex ( column ) ) ; } return null ; }
Source:
public static void getVmSnapshotList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Snapshot > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Snapshot > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllVmSnapshotsByVmId , new org.ovirt.engine.core.common.queries.GetAllVmSnapshotsByVmIdParameters ( id ) , aQuery ) ; }

Target:
public static 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.LUNs > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.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.RunQuery ( VdcQueryType.GetLunsByVgId , params , aQuery ) ; }
Source:
public static java.util.Collection < org.ovirt.engine.core.compat.Guid > getDiskImageIds ( java.util.Collection < org.ovirt.engine.core.common.businessentities.DiskImage > diskImages ) { java.util.Collection < org.ovirt.engine.core.compat.Guid > result = new java.util.ArrayList < > ( ) ; if ( diskImages != null ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : diskImages ) { result.add ( diskImage.getImageId ( ) ) ; } } return result ; }

Target:
public static java.util.Collection < org.ovirt.engine.core.compat.Guid > getDiskImageIds ( java.util.Collection < org.ovirt.engine.core.common.businessentities.storage.DiskImage > diskImages ) { java.util.Collection < org.ovirt.engine.core.compat.Guid > result = new java.util.ArrayList < > ( ) ; if ( diskImages != null ) { for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskImages ) { result.add ( diskImage.getImageId ( ) ) ; } } return result ; }
Source:
private void managePrestartedVmsInPool ( org.ovirt.engine.core.common.businessentities.vm_pools vmPool ) { org.ovirt.engine.core.compat.Guid vmPoolId = vmPool.getvm_pool_id ( ) ; int prestartedVms = org.ovirt.engine.core.bll.VmPoolCommandBase.getNumOfPrestartedVmsInPool ( vmPoolId ) ; int missingPrestartedVms = ( vmPool.getPrestartedVms ( ) ) - prestartedVms ; if ( missingPrestartedVms > 0 ) { int numOfVmsToPrestart = java.lang.Math.min ( missingPrestartedVms , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.VmPoolMonitorBatchSize ) ) ; org.ovirt.engine.core.bll.VmPoolMonitor.log.infoFormat ( "VmPool {0} is missing {1} prestarted Vms, attempting to prestart {2} Vms" , vmPoolId , missingPrestartedVms , numOfVmsToPrestart ) ; prestartVms ( vmPoolId , numOfVmsToPrestart ) ; } }

Target:
private void managePrestartedVmsInPool ( org.ovirt.engine.core.common.businessentities.VmPool vmPool ) { org.ovirt.engine.core.compat.Guid vmPoolId = vmPool.getvm_pool_id ( ) ; int prestartedVms = org.ovirt.engine.core.bll.VmPoolCommandBase.getNumOfPrestartedVmsInPool ( vmPoolId ) ; int missingPrestartedVms = ( vmPool.getPrestartedVms ( ) ) - prestartedVms ; if ( missingPrestartedVms > 0 ) { int numOfVmsToPrestart = java.lang.Math.min ( missingPrestartedVms , org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.VmPoolMonitorBatchSize ) ) ; org.ovirt.engine.core.bll.VmPoolMonitor.log.infoFormat ( "VmPool {0} is missing {1} prestarted Vms, attempting to prestart {2} Vms" , vmPoolId , missingPrestartedVms , numOfVmsToPrestart ) ; prestartVms ( vmPoolId , numOfVmsToPrestart ) ; } }
Source:
protected void EntityPropertyChanged ( java.lang.Object sender , org.ovirt.engine.core.compat.PropertyChangedEventArgs e ) { super . EntityPropertyChanged ( sender , e ) ; if ( e.PropertyName.equals ( "IsSelectedNullable" ) ) { org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel selectionTreeNodeModel = ( ( org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel ) ( sender ) ) ; org.ovirt.engine.ui.uicommonweb.models.tags.TagModel tagModel = ( ( org.ovirt.engine.ui.uicommonweb.models.tags.TagModel ) ( selectionTreeNodeModel.getEntity ( ) ) ) ; tagModel.setSelection ( selectionTreeNodeModel.getIsSelectedNullable ( ) ) ; OnTagSelectionChanged ( tagModel , e ) ; } }

Target:
protected void EntityPropertyChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs e ) { super . EntityPropertyChanged ( sender , e ) ; if ( e.PropertyName.equals ( "IsSelectedNullable" ) ) { org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel selectionTreeNodeModel = ( ( org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel ) ( sender ) ) ; org.ovirt.engine.ui.uicommonweb.models.tags.TagModel tagModel = ( ( org.ovirt.engine.ui.uicommonweb.models.tags.TagModel ) ( selectionTreeNodeModel.getEntity ( ) ) ) ; tagModel.setSelection ( selectionTreeNodeModel.getIsSelectedNullable ( ) ) ; OnTagSelectionChanged ( tagModel , e ) ; } }
Source:
private org.ovirt.engine.core.bll.validator.StorageDomainValidator getValidator ( org.ovirt.engine.core.compat.Guid domainId , org.ovirt.engine.core.compat.Guid storagePoolId ) { return new org.ovirt.engine.core.bll.validator.StorageDomainValidator ( getStorageDomainById ( domainId , storagePoolId ) ) ; }

Target:
private boolean performStorageDomainsChecks ( org.ovirt.engine.core.common.action.LiveMigrateDiskParameters parameters ) { org.ovirt.engine.core.common.businessentities.StorageDomain sourceDomain = getImageSourceDomain ( parameters.getImageId ( ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomain destDomain = getStorageDomainById ( parameters.getStorageDomainId ( ) , org.ovirt.engine.core.bll.lsm.LiveMigrateVmDisksCommand.getStoragePoolId ( ) ) ; return ( ( validateSourceStorageDomain ( sourceDomain ) ) && ( validateDestStorage ( destDomain ) ) ) && ( validateDestStorageAndSourceStorageOfSameTypes ( destDomain , sourceDomain ) ) ; }
Source:
protected void setUpCreationExpectations ( ) { setUpCreationExpectations ( VdcActionType.AddVmTemplate , org.ovirt.engine.core.common.action.AddVmTemplateParameters.class , new java.lang.String [ ] { "Name" , "Description" } , new java.lang.Object [ ] { NAMES [ 0 ] , DESCRIPTIONS [ 0 ] } , true , true , GUIDS [ 0 ] , asList ( GUIDS [ 2 ] ) , asList ( new org.ovirt.engine.core.common.businessentities.AsyncTaskStatus ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.finished ) ) , VdcQueryType.GetInstanceType , org.ovirt.engine.core.common.queries.GetVmTemplateParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , getEntity ( 0 ) ) ; }

Target:
protected void setUpCreationExpectations ( ) { setUpCreationExpectations ( ActionType.AddVmTemplate , org.ovirt.engine.core.common.action.AddVmTemplateParameters.class , new java.lang.String [ ] { "Name" , "Description" } , new java.lang.Object [ ] { NAMES [ 0 ] , DESCRIPTIONS [ 0 ] } , true , true , GUIDS [ 0 ] , asList ( GUIDS [ 2 ] ) , asList ( new org.ovirt.engine.core.common.businessentities.AsyncTaskStatus ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.finished ) ) , VdcQueryType.GetInstanceType , org.ovirt.engine.core.common.queries.GetVmTemplateParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , getEntity ( 0 ) ) ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.UserProfile profile = org.ovirt.engine.core.bll.UpdateUserProfileCommand.getUserProfile ( ) ; profile.setSshPublicKey ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getParameters ( ) . getUserProfile ( ) . getSshPublicKey ( ) ) ; userProfileDao.update ( profile ) ; org.ovirt.engine.core.bll.UpdateUserProfileCommand.setSucceeded ( true ) ; }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.UserProfile profile = org.ovirt.engine.core.bll.UpdateUserProfileCommand.getUserProfile ( ) ; profile.setSshPublicKeyId ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getParameters ( ) . getUserProfile ( ) . getSshPublicKeyId ( ) ) ; profile.setSshPublicKey ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getParameters ( ) . getUserProfile ( ) . getSshPublicKey ( ) ) ; userProfileDao.update ( profile ) ; org.ovirt.engine.core.bll.UpdateUserProfileCommand.setSucceeded ( true ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > hosts = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.VDS > ) ( returnValue ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > upHosts = filterUpHosts ( hosts ) ; proxyHosts.setItems ( addAnyHostInCluster ( upHosts ) ) ; xenProxyHosts.setItems ( addAnyHostInCluster ( upHosts ) ) ; kvmProxyHosts.setItems ( addAnyHostInCluster ( upHosts ) ) ; this . hosts.setItems ( upHosts ) ; stopProgress ( ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections connection = ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( ReturnValue ) ) ; setExportPath ( ( connection == null ? null : connection.getConnection ( ) ) ) ; stopProgress ( ) ; }
Source:
private void networkNotUsedByVmsTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.VM > vms ) { org.mockito.Mockito.when ( vmDao.getAllForNetwork ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vms ) ; org.junit.Assert.assertThat ( validator.networkNotUsedByVms ( ) , matcher ) ; }

Target:
private void networkNotUsedByVmsTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.VM > vms ) { org.mockito.Mockito.when ( vmDao.getAllForNetwork ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( vms ) ; org.junit.Assert.assertThat ( validator.networkNotUsedByVms ( ) , matcher ) ; }
Source:
protected org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters createAddCommandParams ( org.ovirt.engine.api.model.Cluster cluster , org.ovirt.engine.core.common.businessentities.StoragePool dataCenter ) { org.ovirt.engine.core.common.businessentities.VDSGroup clusterEntity = map ( cluster , map ( dataCenter ) ) ; if ( ! ( ( cluster.isSetErrorHandling ( ) ) && ( cluster.getErrorHandling ( ) . isSetOnError ( ) ) ) ) { clusterEntity.setMigrateOnError ( null ) ; } final org.ovirt.engine.core.compat.Guid managementNetworkId = getManagementNetworkId ( cluster , dataCenter.getId ( ) ) ; return new org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters ( clusterEntity , managementNetworkId ) ; }

Target:
private org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters createAddCommandParams ( org.ovirt.engine.api.model.Cluster cluster , org.ovirt.engine.core.common.businessentities.StoragePool dataCenter ) { org.ovirt.engine.core.common.businessentities.VDSGroup clusterEntity = map ( cluster , map ( dataCenter ) ) ; if ( ! ( ( cluster.isSetErrorHandling ( ) ) && ( cluster.getErrorHandling ( ) . isSetOnError ( ) ) ) ) { clusterEntity.setMigrateOnError ( null ) ; } final org.ovirt.engine.core.compat.Guid managementNetworkId = managementNetworkFinder.getManagementNetworkId ( cluster , dataCenter.getId ( ) ) ; return new org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters ( clusterEntity , managementNetworkId ) ; }
Source:
protected void EndImportCommand ( ) { if ( ! ( getParameters ( ) . isImportAsNewEntity ( ) ) ) { setVm ( null ) ; } EndActionOnAllImageGroups ( ) ; if ( ( getVm ( ) ) != null ) { org.ovirt.engine.core.bll.VmHandler.UnLockVm ( getVm ( ) . getId ( ) ) ; UpdateVmImSpm ( ) ; } else { setCommandShouldBeLogged ( false ) ; org.ovirt.engine.core.bll.ImportVmCommand.log.warn ( "ImportVmCommand::EndImportCommand: Vm is null - not performing full EndAction" ) ; } setSucceeded ( true ) ; }

Target:
protected void RemoveVmNetwork ( ) { new org.ovirt.engine.core.bll.network.VmInterfaceManager ( ) . removeAll ( macAdded , getVmId ( ) ) ; }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { return null ; }

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.GlusterVolumeSnapshotListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getCreateSnapshotCommand ( ) ) ) { return snapshotPopupProvider.get ( ) ; } else if ( lastExecutedCommand == ( getModel ( ) . getEditSnapshotScheduleCommand ( ) ) ) { return snapshotPopupProvider.get ( ) ; } return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; }
Source:
static void verifyModelSpecific ( org.ovirt.engine.api.model.DiskSnapshot model , int index ) { org.junit.Assert.assertEquals ( GUIDS [ index ] . toString ( ) , model.getId ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainDiskSnapshotsResourceTest.DISK_ID.toString ( ) , model.getDisk ( ) . getId ( ) ) ; }

Target:
static void verifyModelSpecific ( org.ovirt.engine.api.model.DiskSnapshot model , int index ) { org.junit.jupiter.api.Assertions.assertEquals ( GUIDS [ index ] . toString ( ) , model.getId ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainDiskSnapshotsResourceTest.DISK_ID.toString ( ) , model.getDisk ( ) . getId ( ) ) ; }
Source:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.Cdrom model = new org.ovirt.engine.api.model.Cdrom ( ) ; model.setName ( NAMES [ 0 ] ) ; model.setFile ( new org.ovirt.engine.api.model.File ( ) ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Cdrom" , "add" , "file.id" ) ; } }

Target:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.Cdrom model = new org.ovirt.engine.api.model.Cdrom ( ) ; model.setName ( NAMES [ 0 ] ) ; model.setFile ( new org.ovirt.engine.api.model.File ( ) ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; verifyIncompleteException ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , ( ) -> org.ovirt.engine.api.restapi.resource.collection.add ( model ) ) , "Cdrom" , "add" , "file.id" ) ; }
Source:
public static void getProviderCertificateChain ( 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 ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetProviderCertificateChain , new org.ovirt.engine.core.common.queries.ProviderQueryParameters ( provider ) , aQuery ) ; }

Target:
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 ) ; }
Source:
private void commonTestFlow ( boolean withDummyLun ) { org.mockito.Mockito.when ( getQueryParameters ( ) . getVgId ( ) ) . thenReturn ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VG_ID ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getId ( ) ) . thenReturn ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VDS_ID ) ; expectGetLunsForVg ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VG_ID , withDummyLun ) ; expectGetDeviceList ( ) ; expectGetLunsMap ( ) ; expectGetConnections ( ) ; getQuery ( ) . setInternalExecution ( true ) ; getQuery ( ) . executeCommand ( ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( getQuery ( ) , true ) ; checkReturnValue ( getQuery ( ) ) ; }

Target:
private void commonTestFlow ( boolean withDummyLun ) { org.mockito.Mockito.when ( getQueryParameters ( ) . getVgId ( ) ) . thenReturn ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VG_ID ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getId ( ) ) . thenReturn ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VDS_ID ) ; expectGetLunsForVg ( org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.VG_ID , withDummyLun ) ; expectGetDeviceList ( ) ; expectGetLunsMap ( ) ; expectGetConnections ( ) ; getQuery ( ) . setInternalExecution ( true ) ; getQuery ( ) . executeCommand ( ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( getQuery ( ) , true ) ; org.ovirt.engine.core.bll.GetLunsByVgIdQueryTest.checkReturnValue ( getQuery ( ) ) ; }
Source:
public void testUpdateReadOnly ( ) { setUpGetEntityExpectations ( 2 ) ; setUpDiskVmElementExpectations ( ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateVmDisk , org.ovirt.engine.core.common.action.VmDiskOperationParameterBase.class , new java.lang.String [ ] { "VmId" , "DiskVmElement.ReadOnly" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.VM_ID , java.lang.Boolean.TRUE } , true , true ) ) ; org.ovirt.engine.api.model.Disk disk = resource.update ( getUpdate ( ) ) ; org.junit.Assert.assertNotNull ( disk ) ; }

Target:
public void testUpdateReadOnly ( ) { setUpGetEntityExpectations ( 2 ) ; setUpDiskVmElementExpectations ( ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateVmDisk , org.ovirt.engine.core.common.action.VmDiskOperationParameterBase.class , new java.lang.String [ ] { "VmId" , "DiskVmElement.ReadOnly" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.VM_ID , java.lang.Boolean.TRUE } , true , true ) ) ; org.ovirt.engine.api.model.Disk disk = resource.update ( getUpdate ( ) ) ; org.junit.jupiter.api.Assertions.assertNotNull ( disk ) ; }
Source:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Permission permission ) { validateParameters ( permission , ( isPrincipalSubCollection ( ) ? new java.lang.String [ ] { "role.id|name" , "dataCenter|cluster|host|storageDomain|vm|vmpool|template.id" } : new java.lang.String [ ] { "role.id|name" , "user|group.id" } ) ) ; org.ovirt.engine.core.common.action.PermissionsOperationsParameters parameters = getParameters ( permission ) ; org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; return performCreate ( VdcActionType.AddPermission , parameters , resolver ) ; }

Target:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Permission permission ) { validateParameters ( permission , ( isPrincipalSubCollection ( ) ? new java.lang.String [ ] { "role.id|name" , "dataCenter|cluster|host|storageDomain|vm|vmPool|template.id" } : new java.lang.String [ ] { "role.id|name" , "user|group.id" } ) ) ; org.ovirt.engine.core.common.action.PermissionsOperationsParameters parameters = getParameters ( permission ) ; org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; return performCreate ( VdcActionType.AddPermission , parameters , resolver ) ; }
Source:
protected org.ovirt.engine.core.bll.aaa.SessionDataContainer getSessionDataContainer ( ) { return mockSessionDataContainer ; }

Target:
private org.ovirt.engine.core.bll.QueriesCommandBase < ? > mockQuery ( ) { org.ovirt.engine.core.bll.QueriesCommandBase < ? > query = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.QueriesCommandBase.class , org.mockito.Mockito.withSettings ( ) . useConstructor ( params ) . defaultAnswer ( Answers.CALLS_REAL_METHODS ) ) ; org.mockito.Mockito.doReturn ( mockSessionDataContainer ) . when ( query ) . getSessionDataContainer ( ) ; query.postConstruct ( ) ; return query ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getDbGroupDao ( ) ; newGroup = new org.ovirt.engine.core.common.businessentities.DbGroup ( ) ; newGroup.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; newGroup.setExternalId ( "0" ) ; newGroup.setDomain ( "domain" ) ; newGroup.setName ( "name" ) ; newGroup.setActive ( true ) ; existingGroup = dao.get ( new org.ovirt.engine.core.compat.Guid ( "b399944a-81ab-4ec5-8266-e19ba7c3c9d1" ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getDbGroupDao ( ) ; newGroup = new org.ovirt.engine.core.common.businessentities.DbGroup ( ) ; newGroup.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; newGroup.setExternalId ( "0" ) ; newGroup.setDomain ( "domain" ) ; newGroup.setName ( "name" ) ; newGroup.setActive ( true ) ; newGroup.setNamespace ( "*" ) ; existingGroup = dao.get ( new org.ovirt.engine.core.compat.Guid ( "b399944a-81ab-4ec5-8266-e19ba7c3c9d1" ) ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.AsyncTasks createAsyncTask ( org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo asyncTaskCreationInfo , org.ovirt.engine.core.common.action.VdcActionType parentCommand ) { org.ovirt.engine.core.common.action.VdcActionParametersBase parentParameters = getParentParameters ( parentCommand ) ; return new org.ovirt.engine.core.common.businessentities.AsyncTasks ( parentCommand , org.ovirt.engine.core.common.businessentities.AsyncTaskResultEnum.success , org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.running , asyncTaskCreationInfo.getVdsmTaskId ( ) , parentParameters , getParameters ( ) , asyncTaskCreationInfo.getStepId ( ) , getCommandId ( ) , parentParameters.getCommandId ( ) , asyncTaskCreationInfo.getStoragePoolID ( ) , asyncTaskCreationInfo.getTaskType ( ) ) ; }

Target:
protected void setLock ( org.ovirt.engine.core.utils.lock.EngineLock lock ) { context.withLock ( lock ) ; }
Source:
protected void executeVdsBrokerCommand ( ) { try { status = org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.getBroker ( ) . hotplugMemory ( buildData ( ) ) ; org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.proceedProxyReturnValue ( ) ; } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.setVdsRuntimeError ( e ) ; org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.getVDSReturnValue ( ) . setExceptionString ( null ) ; } }

Target:
protected void executeVdsBrokerCommand ( ) { try { status = org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.getBroker ( ) . hotplugMemory ( buildData ( ) ) ; org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.proceedProxyReturnValue ( ) ; } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.setVdsRuntimeErrorAndReport ( e ) ; org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand.getVDSReturnValue ( ) . setExceptionString ( null ) ; } }
Source:
public void invokeClient ( ) { org.ovirt.engine.ui.frontend.AsyncQuery signCallback = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; signCallback.setModel ( this ) ; signCallback.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue queryRetVal = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) ; java.lang.String signedTicket = queryRetVal.getReturnValue ( ) ; invokeClientNative ( signedTicket ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.SignString , new org.ovirt.engine.core.common.queries.SignStringParameters ( org.ovirt.engine.ui.common.uicommon.WebClientConsoleInvoker.createConnectionString ( host , port , useSsl ) ) , signCallback ) ; }

Target:
public void invokeClient ( ) { org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.SignString , new org.ovirt.engine.core.common.queries.SignStringParameters ( org.ovirt.engine.ui.common.uicommon.WebClientConsoleInvoker.createConnectionString ( host , port , useSsl ) ) , new org.ovirt.engine.ui.frontend.AsyncQuery ( new org.ovirt.engine.ui.frontend.AsyncCallback < org.ovirt.engine.core.common.queries.VdcQueryReturnValue > ( ) { @ java.lang.Override public void onSuccess ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue ) { java.lang.String signedTicket = returnValue.getReturnValue ( ) ; invokeClientNative ( signedTicket ) ; } } ) ) ; }
Source:
public void testGetDataAndSetDataWithSessionParam ( ) { container.SetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE ) ; org.junit.Assert.assertNull ( "Get should return null with an empty session" , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; org.junit.Assert.assertEquals ( "Get should return the value with a given session" , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE , container.GetData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; }

Target:
public void testGetDataAndSetDataWithSessionParam ( ) { container.setData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE ) ; org.junit.Assert.assertNull ( "Get should return null with an empty session" , container.getData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; org.junit.Assert.assertEquals ( "Get should return the value with a given session" , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_VALUE , container.getData ( org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_SESSION_ID , org.ovirt.engine.core.bll.session.SessionDataContainerTest.TEST_KEY , false ) ) ; }
Source:
public void resumeJob ( java.lang.String jobId ) { try { sched.resumeJob ( org.quartz.JobKey.jobKey ( jobId , Scheduler.DEFAULT_GROUP ) ) ; } catch ( org.quartz.SchedulerException se ) { log.error ( ( "failed to pause a job with id=" + jobId ) , se ) ; } }

Target:
public void resumeJob ( java.lang.String jobId ) { try { sched.resumeJob ( org.quartz.JobKey.jobKey ( jobId , Scheduler.DEFAULT_GROUP ) ) ; } catch ( org.quartz.SchedulerException se ) { log.error ( "failed to pause a job with id={}: {}" , jobId , se.getMessage ( ) ) ; log.debug ( "Exception" , se ) ; } }
Source:
public void refresh ( ) { log.debug ( "Affinity Rules Enforcement Manager interval reached." ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmCandidates = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : vdsGroupDao.getWithoutMigratingVms ( ) ) { final org.ovirt.engine.core.common.businessentities.VM candidate = rulesEnforcer.chooseNextVmToMigrate ( cluster ) ; if ( candidate != null ) { vmCandidates.add ( candidate ) ; } } for ( org.ovirt.engine.core.common.businessentities.VM vm : vmCandidates ) { migrateVM ( vm ) ; } }

Target:
public void refresh ( ) { log.debug ( "Affinity Rules Enforcement Manager interval reached." ) ; final java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmCandidates = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : vdsGroupDao.getWithoutMigratingVms ( ) ) { if ( ! ( cluster.isInUpgradeMode ( ) ) ) { final org.ovirt.engine.core.common.businessentities.VM candidate = rulesEnforcer.chooseNextVmToMigrate ( cluster ) ; if ( candidate != null ) { vmCandidates.add ( candidate ) ; } } } for ( org.ovirt.engine.core.common.businessentities.VM vm : vmCandidates ) { migrateVM ( vm ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.StorageType getStorageType ( java.util.List < org.ovirt.engine.core.common.businessentities.LUNs > luns ) { org.ovirt.engine.core.common.businessentities.StorageType storageType = null ; if ( ! ( luns.isEmpty ( ) ) ) { org.ovirt.engine.core.common.businessentities.LUNs lun = luns.get ( 0 ) ; java.util.List < org.ovirt.engine.core.common.businessentities.LUN_storage_server_connection_map > lunConnections = getLunConnections ( lun.getLUN_id ( ) ) ; if ( ! ( lunConnections.isEmpty ( ) ) ) { org.ovirt.engine.core.common.businessentities.storage_server_connections connection = getConnection ( lunConnections.get ( 0 ) . getstorage_server_connection ( ) ) ; storageType = connection.getstorage_type ( ) ; } } return storageType ; }

Target:
private org.ovirt.engine.core.common.businessentities.StorageType getStorageType ( java.util.List < org.ovirt.engine.core.common.businessentities.LUNs > luns ) { org.ovirt.engine.core.common.businessentities.StorageType storageType = null ; if ( ! ( luns.isEmpty ( ) ) ) { org.ovirt.engine.core.common.businessentities.LUNs lun = luns.get ( 0 ) ; java.util.List < org.ovirt.engine.core.common.businessentities.LUN_storage_server_connection_map > lunConnections = getLunConnections ( lun.getLUN_id ( ) ) ; if ( ! ( lunConnections.isEmpty ( ) ) ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections connection = getConnection ( lunConnections.get ( 0 ) . getstorage_server_connection ( ) ) ; storageType = connection.getstorage_type ( ) ; } } return storageType ; }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { java.util.List models = ( ( java.util.List < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > ) ( getValue ( ) . getItems ( ) ) ) ; org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel existingProfileModel = ( ( org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel ) ( value ) ) ; org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel newVnicProfileModel = new org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel ( existingProfileModel.getSourceModel ( ) , existingProfileModel.getDcCompatibilityVersion ( ) , dcId ) ; models.add ( ( ( models.indexOf ( existingProfileModel ) ) + 1 ) , newVnicProfileModel ) ; setAcceptableValues ( models ) ; }

Target:
protected boolean isGhost ( org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel value ) { if ( value != ( defaultProfile ) ) { java.lang.String name = ( ( java.lang.String ) ( value.getName ( ) . getEntity ( ) ) ) ; return ( name == null ) || ( name.isEmpty ( ) ) ; } return false ; }
Source:
protected void setupForStorageTests ( ) { org.mockito.Mockito.doReturn ( multipleSdValidator ) . when ( command ) . getStorageDomainsValidator ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) , org.mockito.ArgumentMatchers.anySetOf ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( multipleSdValidator ) . allDomainsWithinThresholds ( ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( multipleSdValidator ) . allDomainsHaveSpaceForNewDisks ( org.mockito.ArgumentMatchers.anyListOf ( org.ovirt.engine.core.common.businessentities.storage.DiskImage.class ) ) ; }

Target:
protected void setupForStorageTests ( ) { org.mockito.Mockito.doReturn ( multipleSdValidator ) . when ( command ) . getStorageDomainsValidator ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) , org.mockito.ArgumentMatchers.anySetOf ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( multipleSdValidator ) . allDomainsWithinThresholds ( ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( multipleSdValidator ) . allDomainsHaveSpaceForNewDisks ( org.mockito.ArgumentMatchers.anyList ( ) ) ; }
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.AuditLog event = org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.getAuditLogDao ( ) . get ( org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.getParameters ( ) . getAuditLogId ( ) ) ; if ( event == null ) { return failCanDoAction ( VdcBllMessages.AUDIT_LOG_CANNOT_REMOVE_AUDIT_LOG_NOT_EXIST ) ; } if ( ( ! ( AuditLogSeverity.ALERT.equals ( event.getseverity ( ) ) ) ) && ( org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.OVIRT.equalsIgnoreCase ( event.getOrigin ( ) ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN ) ; } return true ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.common.businessentities.AuditLog event = org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.getAuditLogDao ( ) . get ( org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.getParameters ( ) . getAuditLogId ( ) ) ; if ( event == null ) { return failCanDoAction ( VdcBllMessages.AUDIT_LOG_CANNOT_REMOVE_AUDIT_LOG_NOT_EXIST ) ; } if ( ( ! ( AuditLogSeverity.ALERT.equals ( event.getSeverity ( ) ) ) ) && ( org.ovirt.engine.core.bll.RemoveAuditLogByIdCommand.OVIRT.equalsIgnoreCase ( event.getOrigin ( ) ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN ) ; } return true ; }
Source:
private org.ovirt.engine.core.common.businessentities.StoragePool mockStoragePool ( org.ovirt.engine.core.compat.Version compatibilityVersion ) { org.ovirt.engine.core.compat.Guid storagePoolId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.StoragePool storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; storagePool.setId ( storagePoolId ) ; storagePool.setcompatibility_version ( compatibilityVersion ) ; storagePool.setStatus ( StoragePoolStatus.Up ) ; org.mockito.Mockito.when ( storagePoolDAO.get ( storagePoolId ) ) . thenReturn ( storagePool ) ; return storagePool ; }

Target:
private org.ovirt.engine.core.common.businessentities.StoragePool mockStoragePool ( org.ovirt.engine.core.compat.Version compatibilityVersion ) { org.ovirt.engine.core.compat.Guid storagePoolId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.StoragePool storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; storagePool.setId ( storagePoolId ) ; storagePool.setCompatibilityVersion ( compatibilityVersion ) ; storagePool.setStatus ( StoragePoolStatus.Up ) ; org.mockito.Mockito.when ( storagePoolDAO.get ( storagePoolId ) ) . thenReturn ( storagePool ) ; return storagePool ; }
Source:
public void onRemove ( ) { java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > pb = new java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) ; for ( java.lang.Object a : sourceListModel.getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.network.Network network = ( ( org.ovirt.engine.core.common.businessentities.network.Network ) ( a ) ) ; pb.add ( new org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters ( network.getDataCenterId ( ) , network ) ) ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runMultipleAction ( VdcActionType.RemoveNetwork , pb ) ; sourceListModel.setConfirmWindow ( null ) ; }

Target:
public void onRemove ( ) { java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > pb = new java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) ; for ( java.lang.Object a : sourceListModel.getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.network.Network network = ( ( org.ovirt.engine.core.common.businessentities.network.Network ) ( a ) ) ; pb.add ( new org.ovirt.engine.core.common.action.RemoveNetworkParameters ( network.getId ( ) ) ) ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runMultipleAction ( VdcActionType.RemoveNetwork , pb ) ; sourceListModel.setConfirmWindow ( null ) ; }
Source:
public void getVmAndTemplatesIdsWithoutAttachedImageDiכsks ( ) { addVmDevice ( FixturesTool.VM_WITH_NO_ATTACHED_DISKS , FixturesTool.IMAGE_GROUP_ID_2 , null ) ; addVmDevice ( FixturesTool.VM_WITH_NO_ATTACHED_DISKS , FixturesTool.DISK_ID , FixturesTool.EXISTING_SNAPSHOT_ID ) ; java.util.List < org.ovirt.engine.core.compat.Guid > ids = dao.getVmAndTemplatesIdsWithoutAttachedImageDisks ( false ) ; org.junit.Assert.assertTrue ( ids.contains ( FixturesTool.VM_RHEL5_POOL_51 ) ) ; org.junit.Assert.assertTrue ( ids.contains ( FixturesTool.VM_TEMPLATE_RHEL5_2 ) ) ; org.junit.Assert.assertTrue ( ids.contains ( FixturesTool.VM_WITH_NO_ATTACHED_DISKS ) ) ; org.junit.Assert.assertFalse ( ids.contains ( FixturesTool.VM_TEMPLATE_RHEL5 ) ) ; }

Target:
private void checkTemplatesDcAndDisks ( java.util.List < org.ovirt.engine.core.compat.Guid > templateIds , org.ovirt.engine.core.compat.Guid storagePoolId , boolean hasDisks ) { for ( org.ovirt.engine.core.compat.Guid templateId : templateIds ) { org.junit.Assert.assertEquals ( storagePoolId , dbFacade.getVmTemplateDao ( ) . get ( templateId ) . getStoragePoolId ( ) ) ; checkDisks ( templateId , hasDisks ) ; } }
Source:
public void setUp ( ) { java.util.Map < java.lang.String , java.lang.String > headers = new java.util.HashMap < > ( ) ; headers.put ( "my" , "value" ) ; setXmlResponse ( "clusters" , 200 , "<clusters/>" ) ; setXmlResponse ( "clusters/123" , 200 , "<cluster id=\"123\"><name>test</name></cluster>" ) ; startServer ( ) ; connection = ( ( org.ovirt.engine.sdk4.internal.HttpConnection ) ( testConnectionBuilder ( ) . headers ( headers ) . build ( ) ) ) ; clustersService = connection.systemService ( ) . clustersService ( ) ; clusterService = clustersService.clusterService ( "123" ) ; }

Target:
public void setUp ( ) { setXmlResponse ( "clusters" , 200 , "<clusters/>" ) ; setXmlResponse ( "clusters/123" , 200 , "<cluster id=\"123\"><name>test</name></cluster>" ) ; startServer ( ) ; connection = ( ( org.ovirt.engine.sdk4.internal.HttpConnection ) ( testConnectionBuilder ( ) . header ( "my" , "value" ) . build ( ) ) ) ; clustersService = connection.systemService ( ) . clustersService ( ) ; clusterService = clustersService.clusterService ( "123" ) ; }
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.RunQuery ( VdcQueryType.GetAllProviders , new org.ovirt.engine.core.common.queries.GetAllProvidersParameters ( providerType ) , aQuery ) ; }

Target:
public static 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 ) ; }