auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void getDataCentersByStorageDomain ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storageDomainId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStoragePoolsByStorageDomainId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( storageDomainId ) , aQuery ) ; }

Target:
public static void getCPUList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Version version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllServerCpuList , new org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters ( version ) , aQuery ) ; }
Source:
protected void addCommands ( ) { org.ovirt.engine.ui.uicommonweb.UICommand tempVar2 = new org.ovirt.engine.ui.uicommonweb.UICommand ( "OnSave" , this ) ; tempVar2.setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . ok ( ) ) ; tempVar2.setIsDefault ( true ) ; getCommands ( ) . add ( tempVar2 ) ; org.ovirt.engine.ui.uicommonweb.UICommand tempVar3 = new org.ovirt.engine.ui.uicommonweb.UICommand ( "Cancel" , this ) ; tempVar3.setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . cancel ( ) ) ; tempVar3.setIsCancel ( true ) ; getCommands ( ) . add ( tempVar3 ) ; }

Target:
protected void addCommands ( ) { org.ovirt.engine.ui.uicommonweb.UICommand tempVar2 = org.ovirt.engine.ui.uicommonweb.UICommand.createDefaultOkUiCommand ( "OnSave" , this ) ; getCommands ( ) . add ( tempVar2 ) ; org.ovirt.engine.ui.uicommonweb.UICommand tempVar3 = org.ovirt.engine.ui.uicommonweb.UICommand.createCancelUiCommand ( "Cancel" , this ) ; getCommands ( ) . add ( tempVar3 ) ; }
Source:
public void setDebug ( boolean debug ) { this . proxy.setDebug ( debug ) ; }

Target:
private void configureLog4J ( java.lang.Boolean debug ) { java.lang.String fileSeparator = java.lang.System.getProperty ( "file.separator" ) ; java.lang.String configFile = null ; if ( ( debug != null ) && ( java.lang.Boolean.TRUE.equals ( debug ) ) ) { configFile = "log4j-verbose.properties" ; } else { configFile = "log4j-default.properties" ; } org.apache.log4j.PropertyConfigurator.configure ( ( ( ( ( ( java.lang.System.getProperty ( "user.dir" ) ) + fileSeparator ) + "log" ) + fileSeparator ) + configFile ) ) ; }
Source:
protected void syncSearch ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.core.common.queries.IdQueryParameters params = new org.ovirt.engine.core.common.queries.IdQueryParameters ( getEntity ( ) . getId ( ) ) ; params.setRefresh ( getIsQueryFirstTime ( ) ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClustersAndNetworksByNetworkId , params , new org.ovirt.engine.ui.uicommonweb.models.networks.SetItemsAsyncQuery ( ) ) ; }

Target:
protected void syncSearch ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.core.common.queries.IdQueryParameters params = new org.ovirt.engine.core.common.queries.IdQueryParameters ( getEntity ( ) . getId ( ) ) ; params.setRefresh ( getIsQueryFirstTime ( ) ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( QueryType.GetClustersAndNetworksByNetworkId , params , new org.ovirt.engine.ui.uicommonweb.models.networks.SetItemsAsyncQuery ( ) ) ; }
Source:
private void moveVMsToUnknown ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = getVmsToMoveToUnknown ( ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vmList ) { destroyVmOnDestination ( vm ) ; org.ovirt.engine.core.vdsbroker.ResourceManager.getInstance ( ) . runVdsCommand ( VDSCommandType.SetVmStatus , new org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters ( vm.getId ( ) , org.ovirt.engine.core.common.businessentities.VMStatus.Unknown ) ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase logable = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; logable.setVmId ( vm.getId ( ) ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log ( logable , AuditLogType.VM_SET_TO_UNKNOWN_STATUS ) ; } }

Target:
private void moveVMsToUnknown ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = getVmsToMoveToUnknown ( ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vmList ) { destroyVmOnDestination ( vm ) ; org.ovirt.engine.core.vdsbroker.ResourceManager.getInstance ( ) . runVdsCommand ( VDSCommandType.SetVmStatus , new org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters ( vm.getId ( ) , org.ovirt.engine.core.common.businessentities.VMStatus.Unknown ) ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase logable = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; logable.setVmId ( vm.getId ( ) ) ; auditLogDirector.log ( logable , AuditLogType.VM_SET_TO_UNKNOWN_STATUS ) ; } }
Source:
public void getStorageDevices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId ) { 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.GetGlusterStorageDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , aQuery ) ; }

Target:
public void getStorageDevices ( org.ovirt.engine.ui.frontend.AsyncQuery < java.util.List < org.ovirt.engine.core.common.businessentities.gluster.StorageDevice > > aQuery , org.ovirt.engine.core.compat.Guid hostId ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.CastingConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterStorageDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , aQuery ) ; }
Source:
public void testNotRemovingLabeledNetworksNicHasLabelOldAttachRemovedNewAttachWithSameNetworkAddedToNicValid ( ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nicWithLabel = createNic ( "nicWithLabel" ) ; nicWithLabel.setLabels ( java.util.Collections.singleton ( "lbl1" ) ) ; org.ovirt.engine.core.common.businessentities.network.Network network = createNetworkWithNameAndLabel ( "net" , "lbl1" ) ; org.ovirt.engine.core.common.businessentities.network.NetworkAttachment removedAttachment = createNetworkAttachment ( network , nicWithLabel ) ; org.ovirt.engine.core.common.businessentities.network.NetworkAttachment addedAttachment = new org.ovirt.engine.core.common.businessentities.network.NetworkAttachment ( removedAttachment ) ; addedAttachment.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; assertTestNotRemovingLabeledNetworksValid ( nicWithLabel , removedAttachment , new org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidatorTest.ParametersBuilder ( ) . addNetworkAttachments ( addedAttachment ) . build ( ) , network ) ; }

Target:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.errors.EngineMessage engineMessage = org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ; org.ovirt.engine.core.bll.ValidationResult slavesValidationResult = new org.ovirt.engine.core.bll.ValidationResult ( engineMessage , org.ovirt.engine.core.utils.ReplacementUtils.getVariableAssignmentString ( engineMessage , "slaveA" ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.VAR_NETWORK_NAME , "networkName" ) ) ; org.ovirt.engine.core.common.action.CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBondWithNameAndId ( ) ; createOrUpdateBond.setSlaves ( java.util.stream.Stream.of ( "slaveA" , "slaveB" ) . collect ( java.util.stream.Collectors.toSet ( ) ) ) ; doTestValidModifiedBonds ( createOrUpdateBond , ValidationResult.VALID , slavesValidationResult , slavesValidationResult ) ; }
Source:
private void postInitTemplate ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > templates ) { org.ovirt.engine.core.common.businessentities.VmTemplate oldTemplate = getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ; getModel ( ) . getTemplate ( ) . setItems ( templates ) ; getModel ( ) . getTemplate ( ) . setSelectedItem ( org.ovirt.engine.ui.uicommonweb.Linq.firstOrDefault ( templates , ( oldTemplate != null ? new org.ovirt.engine.ui.uicommonweb.Linq.TemplatePredicate ( oldTemplate.getId ( ) ) : new org.ovirt.engine.ui.uicommonweb.Linq.TemplatePredicate ( org.ovirt.engine.core.compat.Guid.Empty ) ) ) ) ; }

Target:
public void oSType_SelectedItemChanged ( ) { org.ovirt.engine.core.common.businessentities.VmTemplate template = getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ; int osType = getModel ( ) . getOSType ( ) . getSelectedItem ( ) ; if ( template != null ) { updateVirtioScsiEnabled ( template.getId ( ) , osType ) ; } }
Source:
public boolean IsBetter ( org.ovirt.engine.core.bll.VDS x , org.ovirt.engine.core.bll.VDS y , org.ovirt.engine.core.bll.VM vm ) { boolean returnValue = false ; boolean x_has_zero = ( x.getvm_count ( ) ) == 0 ; boolean y_has_zero = ( y.getvm_count ( ) ) == 0 ; if ( x_has_zero ) { if ( ! y_has_zero ) { returnValue = true ; } } else if ( ! y_has_zero ) { return super . IsBetter ( x , y , vm ) ; } return returnValue ; }

Target:
public boolean IsBetter ( org.ovirt.engine.core.bll.VDS x , org.ovirt.engine.core.bll.VDS y , org.ovirt.engine.core.bll.VM vm ) { boolean returnValue = false ; boolean x_has_zero = ( x.getVmCount ( ) ) == 0 ; boolean y_has_zero = ( y.getVmCount ( ) ) == 0 ; if ( x_has_zero ) { if ( ! y_has_zero ) { returnValue = true ; } } else if ( ! y_has_zero ) { return super . IsBetter ( x , y , vm ) ; } return returnValue ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult peakConsistentWithAverage ( ) { return ( ( getQos ( ) ) != null ) && ( ( peakLowerThanAverage ( getQos ( ) . getInboundAverage ( ) , getQos ( ) . getInboundPeak ( ) ) ) || ( peakLowerThanAverage ( getQos ( ) . getOutboundAverage ( ) , getQos ( ) . getOutboundPeak ( ) ) ) ) ? new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THAN_AVERAGE ) : org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult peakConsistentWithAverage ( ) { return ( ( getQos ( ) ) != null ) && ( ( peakLowerThanAverage ( getQos ( ) . getInboundAverage ( ) , getQos ( ) . getInboundPeak ( ) ) ) || ( peakLowerThanAverage ( getQos ( ) . getOutboundAverage ( ) , getQos ( ) . getOutboundPeak ( ) ) ) ) ? new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THAN_AVERAGE ) : org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
public static void GetAllProviders ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { 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 ( ) , aQuery ) ; }

Target:
private static void getVlanParentInterface ( org.ovirt.engine.core.compat.Guid vdsID , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetVlanParent , new org.ovirt.engine.core.common.queries.InterfaceAndIdQueryParameters ( vdsID , iface ) , aQuery ) ; }
Source:
protected boolean checkIsConnectionFieldEmpty ( org.ovirt.engine.core.common.businessentities.StorageServerConnections connection ) { if ( org.apache.commons.lang.StringUtils.isEmpty ( connection.getconnection ( ) ) ) { java.lang.String fieldName = org.ovirt.engine.core.bll.storage.connection.StorageServerConnectionCommandBase.getFieldName ( connection ) ; org.ovirt.engine.core.bll.storage.connection.StorageServerConnectionCommandBase.addCanDoActionMessageVariable ( "fieldName" , fieldName ) ; addCanDoActionMessage ( EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_CONNECTION ) ; return true ; } return false ; }

Target:
protected boolean checkIsConnectionFieldEmpty ( org.ovirt.engine.core.common.businessentities.StorageServerConnections connection ) { if ( org.apache.commons.lang.StringUtils.isEmpty ( connection.getConnection ( ) ) ) { java.lang.String fieldName = org.ovirt.engine.core.bll.storage.connection.StorageServerConnectionCommandBase.getFieldName ( connection ) ; org.ovirt.engine.core.bll.storage.connection.StorageServerConnectionCommandBase.addCanDoActionMessageVariable ( "fieldName" , fieldName ) ; addCanDoActionMessage ( EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_CONNECTION ) ; return true ; } return false ; }
Source:
public void testScoreForCpuLoad ( ) throws java.lang.Exception { org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingCPUWeightPolicyUnit unit = mockPolicyUnit ( org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingCPUWeightPolicyUnit.class ) ; java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.BusinessEntity < org.ovirt.engine.core.compat.Guid > > cache = newCache ( ) ; final java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.VDS > hosts = loadHosts ( "basic_power_saving_hosts_cpu_load.csv" , cache ) ; final java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.VM > vms = loadVMs ( "basic_power_saving_vms.csv" , cache ) ; testScore ( unit , hosts , vms , org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingWeightPolicyUnitTest.DESTINATION_HOST ) ; }

Target:
public void testScoreForCpuLoad ( ) throws java.lang.Exception { java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.BusinessEntity < org.ovirt.engine.core.compat.Guid > > cache = newCache ( ) ; final java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.VDS > hosts = loadHosts ( "basic_power_saving_hosts_cpu_load.csv" , cache ) ; final java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.VM > vms = loadVMs ( "basic_power_saving_vms.csv" , cache ) ; testScore ( powerSavingCPUWeightPolicyUnit , hosts , vms , org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingWeightPolicyUnitTest.DESTINATION_HOST ) ; }
Source:
public char [ ] readPassword ( java.lang.String prompt ) { char [ ] password = java.lang.System.console ( ) . readPassword ( prompt ) ; org.ovirt.engine.core.tools.ToolConsole.log.info ( ( ( "Written to console \"" + prompt ) + "\"." ) ) ; org.ovirt.engine.core.tools.ToolConsole.log.info ( "Read password from console." ) ; return password ; }

Target:
public char [ ] readPassword ( java.lang.String prompt ) { char [ ] password = java.lang.System.console ( ) . readPassword ( prompt ) ; org.ovirt.engine.core.tools.ToolConsole.log.info ( "Written to console \"{}\"." , prompt ) ; org.ovirt.engine.core.tools.ToolConsole.log.info ( "Read password from console." ) ; return password ; }
Source:
public static void GetDefaultSpmPriority ( 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 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }

Target:
public static void getDefaultSpmPriority ( 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 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterVolumeSnapshotCreate ( java.lang.String volumeName , java.lang.String snapshotName , java.lang.String description , boolean force ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterVolumeSnapshotCreate ( volumeName , snapshotName , description , force ) ; 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.vdsbroker.StatusOnlyReturnForXmlRpc glusterVolumeGeoRepSessionPause ( java.lang.String masterVolumeName , java.lang.String slaveHost , java.lang.String slaveVolumeName , boolean force ) { try { return new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( vdsServer.glusterVolumeGeoRepSessionPause ( masterVolumeName , slaveHost , slaveVolumeName , force ) ) ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
public void testListCrash ( ) throws java.lang.Exception { collection.setUriInfo ( setUpUriExpectations ( null ) ) ; setUpEntityQueryExpectations ( org.ovirt.engine.api.restapi.resource.FAILURE ) ; try { getCollection ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_SERVER_LOCALE , new java.lang.RuntimeException ( FAILURE ) ) ; } }

Target:
public void testListCrash ( ) throws java.lang.Exception { collection.setUriInfo ( setUpUriExpectations ( null ) ) ; setUpEntityQueryExpectations ( org.ovirt.engine.api.restapi.resource.FAILURE ) ; try { getCollection ( ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_SERVER_LOCALE , new java.lang.RuntimeException ( FAILURE ) ) ; } }
Source:
public void initialize ( ) { super . initialize ( ) ; org.ovirt.engine.ui.uicommonweb.UICommand onSaveCommand = new org.ovirt.engine.ui.uicommonweb.UICommand ( "OnSave" , this ) ; onSaveCommand.setTitle ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.ok ( ) ) ; onSaveCommand.setIsDefault ( true ) ; getCommands ( ) . add ( onSaveCommand ) ; getCommands ( ) . add ( getCancelCommand ( ) ) ; if ( ( getVm ( ) ) != null ) { updateBootableDiskAvailable ( ) ; } updateDatacenters ( ) ; }

Target:
private void commonInitialize ( ) { super . initialize ( ) ; org.ovirt.engine.ui.uicommonweb.UICommand onSaveCommand = new org.ovirt.engine.ui.uicommonweb.UICommand ( "OnSave" , this ) ; onSaveCommand.setTitle ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.constants.ok ( ) ) ; onSaveCommand.setIsDefault ( true ) ; getCommands ( ) . add ( onSaveCommand ) ; getCommands ( ) . add ( getCancelCommand ( ) ) ; if ( ( getVm ( ) ) != null ) { updateBootableDiskAvailable ( ) ; getIsUsingScsiReservation ( ) . setIsAvailable ( true ) ; } updateDatacenters ( ) ; }
Source:
public static java.lang.String getSchemaName ( ) { return org.ovirt.engine.extension.aaa.jdbc.core.datasource.DataSourceProvider.schemaName ; }

Target:
private javax.sql.DataSource getDataSourceFromJNDI ( java.lang.String property ) { javax.sql.DataSource dataSource ; try { javax.naming.InitialContext context = new javax.naming.InitialContext ( ) ; dataSource = ( ( javax.sql.DataSource ) ( context.lookup ( property ) ) ) ; } catch ( javax.naming.NamingException e ) { throw new java.lang.IllegalArgumentException ( "Could not lookup datasource." , e ) ; } return dataSource ; }
Source:
private void createDummyPolicyUnit ( ) { dummyPolicyUnit = new org.ovirt.engine.core.common.scheduling.PolicyUnit ( ) ; dummyPolicyUnit.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; dummyPolicyUnit.setName ( "Dummy policy unit" ) ; dummyPolicyUnit.setDescription ( "Description" ) ; dummyPolicyUnit.setPolicyUnitType ( PolicyUnitType.Filter ) ; dummyPolicyUnit.setParameterRegExMap ( new java.util.LinkedHashMap < java.lang.String , java.lang.String > ( ) ) ; }

Target:
private void createDummyPolicyUnit ( ) { dummyPolicyUnit = new org.ovirt.engine.core.common.scheduling.PolicyUnit ( ) ; dummyPolicyUnit.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; dummyPolicyUnit.setName ( "Dummy policy unit" ) ; dummyPolicyUnit.setDescription ( "Description" ) ; dummyPolicyUnit.setPolicyUnitType ( PolicyUnitType.FILTER ) ; dummyPolicyUnit.setParameterRegExMap ( new java.util.LinkedHashMap < java.lang.String , java.lang.String > ( ) ) ; }
Source:
protected java.util.List < org.ovirt.engine.api.model.Network > getNetworks ( ) { return getBackendCollection ( VdcQueryType.GetNetworksByDataCenterId , getQueryParameters ( ) ) ; }

Target:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Network network ) { validateParameters ( network , "name" ) ; org.ovirt.engine.api.model.Network entity = map ( network ) ; org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters parameters = new org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters ( dataCenterId , entity ) ; if ( network.isSetProfileRequired ( ) ) { parameters.setVnicProfileRequired ( network.isProfileRequired ( ) ) ; } return performCreate ( VdcActionType.AddNetwork , parameters , new org.ovirt.engine.api.restapi.resource.BackendDataCenterNetworksResource.AddedNetworkResolver ( ) ) ; }
Source:
private static boolean handlesEvent ( com.google.gwt.view.client.CellPreviewEvent < org.ovirt.engine.ui.uicommonweb.models.EntityModel > event ) { com.google.gwt.dom.client.NativeEvent nativeEvent = event.getNativeEvent ( ) ; if ( ! ( "click" . equals ( nativeEvent.getType ( ) . toLowerCase ( ) ) ) ) { return false ; } com.google.gwt.dom.client.Element target = nativeEvent.getEventTarget ( ) . cast ( ) ; return "input" . equals ( target.getTagName ( ) . toLowerCase ( ) ) ; }

Target:
private static boolean handlesEvent ( com.google.gwt.view.client.CellPreviewEvent < org.ovirt.engine.ui.uicommonweb.models.EntityModel > event ) { com.google.gwt.dom.client.NativeEvent nativeEvent = event.getNativeEvent ( ) ; if ( ! ( BrowserEvents.CLICK.equals ( nativeEvent.getType ( ) ) ) ) { return false ; } com.google.gwt.dom.client.Element target = nativeEvent.getEventTarget ( ) . cast ( ) ; return "input" . equals ( target.getTagName ( ) . toLowerCase ( ) ) ; }
Source:
protected void ExecuteVdsIdCommand ( ) { if ( ( _vdsManager ) != null ) { org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setvm_count ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setvms_cores_count ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setvm_active ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setvm_migrating ( 0 ) ; _vdsManager.UpdateDynamicData ( org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . getDynamicData ( ) ) ; } else { org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; } }

Target:
protected void ExecuteVdsIdCommand ( ) { if ( ( _vdsManager ) != null ) { org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setVmCount ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setVmsCoresCount ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setVmActive ( 0 ) ; org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . setVmMigrating ( 0 ) ; _vdsManager.UpdateDynamicData ( org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVds ( ) . getDynamicData ( ) ) ; } else { org.ovirt.engine.core.vdsbroker.UpdateVdsVMsClearedVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; } }
Source:
public org.ovirt.engine.sdk.entities.Response delete ( java.lang.String correlationId ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = this . getHref ( ) ; org.ovirt.engine.sdk.utils.HttpHeaderBuilder headersBuilder = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) ; if ( correlationId != null ) { headersBuilder.add ( "Correlation-Id" , correlationId ) ; } java.util.List < org.apache.http.Header > headers = headersBuilder.build ( ) ; org.ovirt.engine.sdk.utils.UrlBuilder urlBuilder = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) ; url = urlBuilder.build ( ) ; return getProxy ( ) . delete ( url , org.ovirt.engine.sdk.entities.Response.class , headers ) ; }

Target:
public org.ovirt.engine.sdk.entities.Response delete ( java.lang.Boolean async ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = this . getHref ( ) ; org.ovirt.engine.sdk.utils.HttpHeaderBuilder headersBuilder = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) ; java.util.List < org.apache.http.Header > headers = headersBuilder.build ( ) ; org.ovirt.engine.sdk.utils.UrlBuilder urlBuilder = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) ; if ( async != null ) { urlBuilder.add ( "async" , async , UrlParameterType.MATRIX ) ; } url = urlBuilder.build ( ) ; return getProxy ( ) . delete ( url , org.ovirt.engine.sdk.entities.Response.class , headers ) ; }
Source:
public void testTypedFile ( ) throws java.lang.Exception { java.io.File file = writeConf ( "a=/b" ) ; org.ovirt.engine.core.authentication.Configuration config = org.ovirt.engine.core.authentication.Configuration.loadFile ( file ) ; junit.framework.Assert.assertNotNull ( config ) ; org.ovirt.engine.core.authentication.ConfigurationTest.TypedFile view = config.getView ( org.ovirt.engine.core.authentication.ConfigurationTest.TypedFile.class ) ; junit.framework.Assert.assertNotNull ( view ) ; junit.framework.Assert.assertEquals ( new java.io.File ( "/b" ) , view.getA ( ) ) ; }

Target:
public void testTypedFile ( ) throws java.lang.Exception { java.io.File file = writeConf ( "a=b" ) ; org.ovirt.engine.core.authentication.Configuration config = org.ovirt.engine.core.authentication.Configuration.loadFile ( file ) ; junit.framework.Assert.assertNotNull ( config ) ; org.ovirt.engine.core.authentication.ConfigurationTest.TypedFile view = config.getView ( org.ovirt.engine.core.authentication.ConfigurationTest.TypedFile.class ) ; junit.framework.Assert.assertNotNull ( view ) ; junit.framework.Assert.assertEquals ( new java.io.File ( "b" ) , view.getA ( ) ) ; }
Source:
public void testGetAllForStoragePoolAndStatusesForAllStatuses ( ) { prepareHostWithDifferentStatus ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > result = dao.getAllForStoragePoolAndStatuses ( existingVds.getStoragePoolId ( ) , null ) ; java.util.EnumSet < org.ovirt.engine.core.common.businessentities.VDSStatus > statuses = java.util.EnumSet.noneOf ( org.ovirt.engine.core.common.businessentities.VDSStatus.class ) ; for ( org.ovirt.engine.core.common.businessentities.VDS vds : result ) { statuses.add ( vds.getStatus ( ) ) ; } assertCorrectGetAllResult ( result ) ; org.junit.Assert.assertTrue ( "more than one different status expected" , ( ( statuses.size ( ) ) > 1 ) ) ; }

Target:
public void testGetAllForStoragePoolAndStatusesForAllStatuses ( ) { prepareHostWithDifferentStatus ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > result = dao.getAllForStoragePoolAndStatuses ( existingVds.getStoragePoolId ( ) , null ) ; java.util.Set < org.ovirt.engine.core.common.businessentities.VDSStatus > statuses = result.stream ( ) . map ( VDS :: getStatus ) . collect ( java.util.stream.Collectors.toSet ( ) ) ; assertCorrectGetAllResult ( result ) ; org.junit.Assert.assertTrue ( "more than one different status expected" , ( ( statuses.size ( ) ) > 1 ) ) ; }
Source:
protected java.util.Map < java.lang.String , org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.lang.String > > getExclusiveLocks ( ) { return java.util.Collections.singletonMap ( org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.getVmId ( ) . toString ( ) , org.ovirt.engine.core.bll.LockMessagesMatchUtil.makeLockingPair ( LockingGroup.VM , new org.ovirt.engine.core.bll.LockMessage ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED ) . with ( "VmName" , org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.getVmName ( ) ) ) ) ; }

Target:
public org.ovirt.engine.core.bll.tasks.interfaces.CommandCallback getCallback ( ) { return callbackProvider.get ( ) ; }
Source:
public static void getMaximalVmMemSize32OS ( 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 ( ) : 20480 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.VM32BitMaxMemorySizeInMB , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public static boolean getScheudulingAllowOverbookingSupported ( ) { return ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigValuePreConverted ( ConfigurationValues.SchedulerAllowOverBooking , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) ) ) ; }
Source:
private void map ( org.ovirt.engine.core.common.businessentities.CommandEntity cmdEntity , org.ovirt.engine.core.common.businessentities.AsyncTasks asyncTask ) { if ( cmdEntity != null ) { asyncTask.setTaskParameters ( cmdEntity.getCommandParameters ( ) ) ; asyncTask.setRootCommandId ( cmdEntity.getRootCommandId ( ) ) ; asyncTask.setCommandStatus ( cmdEntity.getCommandStatus ( ) ) ; asyncTask.setCommandType ( cmdEntity.getCommandType ( ) ) ; asyncTask.setCreatedAt ( cmdEntity.getCreatedAt ( ) ) ; asyncTask.setCallBackEnabled ( cmdEntity.isCallBackEnabled ( ) ) ; } }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.AsyncTask > getAllAsyncTasksFromDb ( org.ovirt.engine.core.bll.tasks.interfaces.CommandCoordinator coco ) { java.util.List < org.ovirt.engine.core.common.businessentities.AsyncTask > asyncTasks = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAsyncTaskDao ( ) . getAll ( ) ; for ( org.ovirt.engine.core.common.businessentities.AsyncTask asyncTask : asyncTasks ) { asyncTask.setRootCmdEntity ( getCommandEntity ( asyncTask.getRootCommandId ( ) ) ) ; asyncTask.setChildCmdEntity ( getCommandEntity ( asyncTask.getCommandId ( ) ) ) ; } return asyncTasks ; }
Source:
public void onSuccessAudit ( ) { mockExecutor ( true ) ; org.mockito.Mockito.doNothing ( ) . when ( command ) . teardown ( ) ; command.executeCommand ( ) ; org.mockito.Mockito.verify ( auditLogDirector , org.mockito.Mockito.times ( 2 ) ) . log ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.AuditLogType.class ) ) ; }

Target:
public void onSuccessAudit ( ) { mockExecutor ( true ) ; org.mockito.Mockito.doNothing ( ) . when ( command ) . teardown ( ) ; command.executeCommand ( ) ; org.mockito.Mockito.verify ( auditLogDirector , org.mockito.Mockito.times ( 2 ) ) . log ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.AuditLogType.class ) ) ; }
Source:
public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.bll.storage.StorageHelperDirector.getInstance ( ) . getItem ( domain.getstorage_type ( ) ) . StorageDomainRemoved ( domain.getStorageStaticData ( ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainDao ( ) . remove ( domain.getId ( ) ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.bll.storage.StorageHelperDirector.getInstance ( ) . getItem ( domain.getstorage_type ( ) ) . storageDomainRemoved ( domain.getStorageStaticData ( ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainDao ( ) . remove ( domain.getId ( ) ) ; return null ; }
Source:
public void testUpdate ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( 1 , false , false , false , false ) ; setUpEntityQueryExpectations ( 1 , true , true , true , true ) ; setUpClusterExpectations ( GUIDS [ 1 ] ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.UpdateNetworkOnCluster , org.ovirt.engine.core.common.action.NetworkClusterParameters.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , true , true ) ) ; verifyUpdate ( resource.update ( getModel ( 0 ) ) ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetNetworkById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendClusterNetworkResourceTest.NETWORK_ID } , getEntity ( 0 ) ) ; verifyModel ( resource.get ( ) , 0 ) ; }
Source:
void initCheckBoxEditors ( ) { attachFloppyEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; attachIsoEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; runAsStatelessEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; runAndPauseEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; useAlternateCredentialsEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; }

Target:
void initCheckBoxEditors ( ) { attachFloppyEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; attachIsoEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; bootMenuEnabledEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; runAsStatelessEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; runAndPauseEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; useAlternateCredentialsEditor = new org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor ( org.ovirt.engine.ui.common.widget.Align.RIGHT ) ; }
Source:
public static boolean setDiskAlias ( org.ovirt.engine.core.common.businessentities.BaseDisk disk , org.ovirt.engine.core.common.businessentities.VM vm ) { if ( disk != null ) { java.lang.String vmName = "" ; int count = 1 ; if ( vm != null ) { vmName = vm.getVmName ( ) ; count = ( vm.getDiskMapCount ( ) ) + 1 ; } disk.setDiskAlias ( org.ovirt.engine.core.bll.ImagesHandler.getSuggestedDiskAlias ( disk , vmName , count ) ) ; return true ; } else { org.ovirt.engine.core.bll.ImagesHandler.log.errorFormat ( "Disk object is null" ) ; return false ; } }

Target:
private static java.lang.String nullSafeGetVmName ( org.ovirt.engine.core.common.businessentities.VM vm ) { return vm == null ? "" : vm.getVmName ( ) ; }
Source:
public void OnSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { org.ovirt.engine.ui.uicommonweb.models.SearchableListModel bookmarkListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel ) ( model ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Bookmark > resultList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Bookmark > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ; java.util.Collections.sort ( resultList , org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel.COMPARATOR ) ; bookmarkListModel.setItems ( resultList ) ; }

Target:
public void OnSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { org.ovirt.engine.ui.uicommonweb.models.SearchableListModel bookmarkListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel ) ( model ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Bookmark > resultList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Bookmark > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ; if ( resultList != null ) { java.util.Collections.sort ( resultList , org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel.COMPARATOR ) ; } setIsBookmarkInitiated ( true ) ; bookmarkListModel.setItems ( resultList ) ; setIsBookmarkInitiated ( false ) ; }
Source:
public void testGetAllStoragePoolSearch ( ) throws java.lang.Exception { org.ovirt.engine.core.common.queries.SearchParameters searchParam = new org.ovirt.engine.core.common.queries.SearchParameters ( ( "Datacenter" + ( org.ovirt.engine.core.common.utils.CommonConstants.QUERY_RETURN_TYPE_SEPARATOR ) ) , org.ovirt.engine.core.common.interfaces.SearchType.StoragePool ) ; org.ovirt.engine.core.bll.SearchQuery < org.ovirt.engine.core.common.queries.SearchParameters > searchQuery = spySearchQuery ( searchParam ) ; searchQuery.executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( storagePoolResultList , searchQuery.getQueryReturnValue ( ) . getReturnValue ( ) ) ; }

Target:
public void testGetAllStoragePoolSearch ( ) throws java.lang.Exception { org.mockito.Mockito.when ( getQueryParameters ( ) . getSearchPattern ( ) ) . thenReturn ( ( "Datacenter" + ( org.ovirt.engine.core.common.utils.CommonConstants.QUERY_RETURN_TYPE_SEPARATOR ) ) ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getSearchTypeValue ( ) ) . thenReturn ( SearchType.StoragePool ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( storagePoolResultList , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }
Source:
public void testCanDoAction ( ) { expectGetStoragePool ( STORAGE_POOL_ID ) ; expectGetStorageDomain ( STORAGE_DOMAIN_ID , STORAGE_POOL_ID , StorageDomainType.Data , StorageType.NFS ) ; expectGetVds ( VDS_ID ) ; expectGetIsoMap ( STORAGE_DOMAIN_ID ) ; expectBusinessEntitySnapshotDAO ( ) ; org.ovirt.engine.core.bll.storage.RemoveStorageDomainCommand < org.ovirt.engine.core.common.action.RemoveStorageDomainParameters > cmd = createCommand ( true ) ; org.junit.Assert.assertTrue ( cmd.canDoAction ( ) ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( cmd , false ) ; org.junit.Assert.assertEquals ( "Wrong number of messages" , 0 , cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . size ( ) ) ; }

Target:
public void testCanDoAction ( ) { expectGetStoragePool ( STORAGE_POOL_ID ) ; expectGetStorageDomain ( STORAGE_DOMAIN_ID , STORAGE_POOL_ID , StorageDomainType.Data , StorageType.NFS ) ; expectGetVds ( VDS_ID ) ; expectGetIsoMap ( STORAGE_DOMAIN_ID ) ; expectBusinessEntitySnapshotDAO ( ) ; org.ovirt.engine.core.bll.storage.RemoveStorageDomainCommand < org.ovirt.engine.core.common.action.RemoveStorageDomainParameters > cmd = createCommand ( true ) ; org.junit.Assert.assertTrue ( cmd.canDoAction ( ) ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( cmd , false ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkMessages ( cmd ) ; }
Source:
public void initMigrationPolicies ( boolean isEdit ) { java.util.List < org.ovirt.engine.core.common.migration.MigrationPolicy > policies = org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getMigrationPolicies ( ) ; getMigrationPolicies ( ) . setItems ( policies ) ; if ( isEdit ) { for ( org.ovirt.engine.core.common.migration.MigrationPolicy policy : policies ) { if ( java.util.Objects.equals ( policy.getId ( ) , getEntity ( ) . getMigrationPolicyId ( ) ) ) { getMigrationPolicies ( ) . setSelectedItem ( policy ) ; break ; } } } }

Target:
public void initMigrationPolicies ( boolean isEdit ) { java.util.List < org.ovirt.engine.core.common.migration.MigrationPolicy > policies = org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getMigrationPolicies ( ) ; getMigrationPolicies ( ) . setItems ( policies ) ; org.ovirt.engine.core.common.migration.MigrationPolicy migrationPolicy = ( isEdit ) ? findMigrationPolicyById ( getEntity ( ) . getMigrationPolicyId ( ) , policies ) : findFirstNonEmptyMigrationPolicy ( policies ) ; getMigrationPolicies ( ) . setSelectedItem ( ( migrationPolicy != null ? migrationPolicy : findMigrationPolicyById ( NoMigrationPolicy.ID , policies ) ) ) ; }
Source:
public static void getStorageConnectionById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String id , boolean isRefresh ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( source ) ) : null ; } } ; org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase params = new org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase ( id ) ; params.setRefresh ( isRefresh ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetStorageServerConnectionById , params , aQuery ) ; }

Target:
public static void getDataCentersByStorageDomain ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storageDomainId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetStoragePoolsByStorageDomainId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( storageDomainId ) , aQuery ) ; }
Source:
public void testDetach ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.DetachDiskFromVm , org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters.class , new java.lang.String [ ] { "VmId" , "EntityInfo" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.AbstractBackendDisksResourceTest.PARENT_ID , new org.ovirt.engine.core.common.asynctasks.EntityInfo ( org.ovirt.engine.core.common.VdcObjectType.Disk , org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.DISK_ID ) } , true , true ) ) ; org.ovirt.engine.api.model.Action action = new org.ovirt.engine.api.model.Action ( ) ; action.setDetach ( true ) ; verifyRemove ( resource.remove ( action ) ) ; }

Target:
public void testIncompleteExport ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { control.replay ( ) ; resource.doExport ( new org.ovirt.engine.api.model.Action ( ) ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Action" , "doExport" , "storageDomain.id|name" ) ; } }
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.bll.GetAllRolesQuery.getQueryReturnValue ( ) . setReturnValue ( org.ovirt.engine.core.bll.GetAllRolesQuery.getDbFacade ( ) . getRoleDao ( ) . getAll ( ) ) ; }

Target:
protected void executeQueryCommand ( ) { if ( ! ( isAdminUser ( ) ) ) { setReturnValue ( org.ovirt.engine.core.bll.GetAllRolesQuery.getDbFacade ( ) . getRoleDao ( ) . getAllNonAdminRoles ( ) ) ; } else { setReturnValue ( org.ovirt.engine.core.bll.GetAllRolesQuery.getDbFacade ( ) . getRoleDao ( ) . getAll ( ) ) ; } }
Source:
private java.lang.String GetValue ( java.lang.Object obj ) { if ( obj instanceof org.ovirt.engine.core.common.businessentities.VM ) { return ( ( org.ovirt.engine.core.common.businessentities.VM ) ( obj ) ) . getvm_name ( ) ; } if ( obj instanceof org.ovirt.engine.core.common.businessentities.vm_pools ) { return ( ( org.ovirt.engine.core.common.businessentities.vm_pools ) ( obj ) ) . getvm_pool_name ( ) ; } throw new org.ovirt.engine.core.compat.NotImplementedException ( ) ; }

Target:
private java.lang.String GetValue ( java.lang.Object obj ) { if ( obj instanceof org.ovirt.engine.core.common.businessentities.VM ) { return ( ( org.ovirt.engine.core.common.businessentities.VM ) ( obj ) ) . getVmName ( ) ; } if ( obj instanceof org.ovirt.engine.core.common.businessentities.vm_pools ) { return ( ( org.ovirt.engine.core.common.businessentities.vm_pools ) ( obj ) ) . getvm_pool_name ( ) ; } throw new org.ovirt.engine.core.compat.NotImplementedException ( ) ; }
Source:
public boolean isNetmaskValid ( java.lang.String netmask ) { long addressInBits = org.ovirt.engine.core.common.utils.IpAddressConverter.getInstance ( ) . convertIpToLong ( netmask ) ; long mask = 1 ; boolean isFirstOneFound = false ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( isFirstOneFound && ( ( mask & addressInBits ) != 1 ) ) { return false ; } if ( ( mask & addressInBits ) == 1 ) { isFirstOneFound = true ; } addressInBits >>= 1 ; } return true ; }

Target:
public boolean isNetmaskValid ( java.lang.String netmask ) { long addressInBits = ipAddressConverter.convertIpAddressToLong ( netmask ) ; long mask = 1 ; boolean isFirstOneFound = false ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( isFirstOneFound && ( ( mask & addressInBits ) != 1 ) ) { return false ; } if ( ( mask & addressInBits ) == 1 ) { isFirstOneFound = true ; } addressInBits >>= 1 ; } return true ; }