auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getQueryReturnValue ( ) . setReturnValue ( org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getDbFacade ( ) . getQuotaDao ( ) . getQuotaByAdElementId ( org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getParameters ( ) . getAdElementId ( ) , org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getParameters ( ) . getStoragePoolId ( ) ) ) ; }

Target:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getQueryReturnValue ( ) . setReturnValue ( org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getDbFacade ( ) . getQuotaDao ( ) . getQuotaByAdElementId ( org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getParameters ( ) . getAdElementId ( ) , org.ovirt.engine.core.bll.GetQuotasByAdElementIdQuery.getParameters ( ) . getStoragePoolId ( ) , false ) ) ; }
Source:
public void testUpdate ( ) { org.ovirt.engine.core.common.businessentities.profiles.CpuProfile profile = dao.get ( FixturesTool.CPU_PROFILE_1 ) ; org.junit.Assert.assertNotNull ( profile ) ; org.junit.Assert.assertTrue ( FixturesTool.QOS_ID_4.equals ( profile.getQosId ( ) ) ) ; profile.setQosId ( FixturesTool.QOS_ID_5 ) ; profile.setDescription ( "desc1" ) ; dao.update ( profile ) ; org.ovirt.engine.core.common.businessentities.profiles.CpuProfile result = dao.get ( profile.getId ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( profile , result ) ; }

Target:
public void testUpdate ( ) { org.ovirt.engine.core.common.businessentities.profiles.CpuProfile profile = dao.get ( FixturesTool.CPU_PROFILE_1 ) ; org.junit.Assert.assertNotNull ( profile ) ; org.junit.Assert.assertEquals ( FixturesTool.QOS_ID_4 , profile.getQosId ( ) ) ; profile.setQosId ( FixturesTool.QOS_ID_5 ) ; profile.setDescription ( "desc1" ) ; dao.update ( profile ) ; org.ovirt.engine.core.common.businessentities.profiles.CpuProfile result = dao.get ( profile.getId ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( profile , result ) ; }
Source:
public void testGetNetworkDevices ( ) throws java.lang.Exception { java.util.List < java.lang.String > networkDevices = OsRepositoryImpl.INSTANCE.getNetworkDevices ( 777 , null ) ; org.junit.Assert.assertTrue ( ( ( networkDevices.size ( ) ) == 2 ) ) ; for ( java.lang.String device : org.ovirt.engine.core.utils.OsRepositoryImplTest.NETWORK_DEVICES.split ( "," ) ) { org.junit.Assert.assertTrue ( networkDevices.contains ( device ) ) ; } }

Target:
public void testGetNetworkDevices ( ) throws java.lang.Exception { java.util.List < java.lang.String > networkDevices = OsRepositoryImpl.INSTANCE.getNetworkDevices ( 777 , null ) ; org.junit.Assert.assertEquals ( 2 , networkDevices.size ( ) ) ; for ( java.lang.String device : org.ovirt.engine.core.utils.OsRepositoryImplTest.NETWORK_DEVICES.split ( "," ) ) { org.junit.Assert.assertTrue ( networkDevices.contains ( device ) ) ; } }
Source:
protected void service ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response ) throws java.io.IOException , javax.servlet.ServletException { try { org.ovirt.engine.core.sso.utils.SsoUtils.sendJsonData ( response , org.ovirt.engine.core.sso.servlets.OpenIdUtils.getJson ( buildResponse ( ) ) ) ; } catch ( java.lang.Exception ex ) { org.ovirt.engine.core.sso.utils.SsoUtils.sendJsonDataWithMessage ( response , SsoConstants.ERR_CODE_SERVER_ERROR , ex ) ; } }

Target:
protected void service ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response ) throws java.io.IOException , javax.servlet.ServletException { try { org.ovirt.engine.core.sso.utils.SsoUtils.sendJsonData ( response , org.ovirt.engine.core.sso.servlets.OpenIdUtils.getJson ( buildResponse ( ) ) ) ; } catch ( java.lang.Exception ex ) { org.ovirt.engine.core.sso.utils.SsoUtils.sendJsonDataWithMessage ( request , response , SsoConstants.ERR_CODE_SERVER_ERROR , ex ) ; } }
Source:
public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.bll.context.CompensationContext context = getCompensationContext ( ) ; for ( org.ovirt.engine.core.common.businessentities.StorageDomain domain : domains ) { for ( org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap map : getStoragePoolIsoMap ( domain ) ) { context.snapshotEntityStatus ( map , map.getstatus ( ) ) ; updateStatus ( map , status ) ; } } getCompensationContext ( ) . stateChanged ( ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.bll.context.CompensationContext context = getCompensationContext ( ) ; for ( org.ovirt.engine.core.common.businessentities.StorageDomain domain : domains ) { for ( org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap map : getStoragePoolIsoMap ( domain ) ) { context.snapshotEntityStatus ( map , map.getStatus ( ) ) ; updateStatus ( map , status ) ; } } getCompensationContext ( ) . stateChanged ( ) ; return null ; }
Source:
public void testGetAllForValidQos ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > result = dao.getAllForQos ( FixturesTool.HOST_NETWORK_QOS_A ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertTrue ( ( ( result.size ( ) ) == 1 ) ) ; org.junit.Assert.assertEquals ( result.get ( 0 ) . getId ( ) , FixturesTool.NETWORK_ENGINE ) ; }

Target:
public void testGetAllForValidQos ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > result = dao.getAllForQos ( FixturesTool.HOST_NETWORK_QOS_A ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertEquals ( 1 , result.size ( ) ) ; org.junit.Assert.assertEquals ( FixturesTool.NETWORK_ENGINE , result.get ( 0 ) . getId ( ) ) ; }
Source:
public void diskImagesDontExist ( ) { org.mockito.Mockito.doReturn ( false ) . when ( validator ) . isDiskExists ( disk1.getId ( ) ) ; org.mockito.Mockito.doReturn ( false ) . when ( validator ) . isDiskExists ( disk2.getId ( ) ) ; org.junit.Assert.assertThat ( validator.diskImagesNotExist ( ) , org.junit.matchers.JUnitMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_DISKS_NOT_EXIST ) ) ) ; }

Target:
public void diskImagesDontExist ( ) { org.mockito.Mockito.doReturn ( false ) . when ( validator ) . isDiskExists ( disk1.getId ( ) ) ; org.mockito.Mockito.doReturn ( false ) . when ( validator ) . isDiskExists ( disk2.getId ( ) ) ; org.junit.Assert.assertThat ( validator.diskImagesNotExist ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_DISKS_NOT_EXIST ) ) ; }
Source:
protected int getTotalCpuCores ( ) { try { return ( getModel ( ) . getTotalCPUCores ( ) . getEntity ( ) ) != null ? java.lang.Integer.parseInt ( getModel ( ) . getTotalCPUCores ( ) . getEntity ( ) . toString ( ) ) : 0 ; } catch ( java.lang.NumberFormatException e ) { return 0 ; } }

Target:
protected int getTotalCpuCores ( ) { try { return ( getModel ( ) . getTotalCPUCores ( ) . getEntity ( ) ) != null ? java.lang.Integer.parseInt ( getModel ( ) . getTotalCPUCores ( ) . getEntity ( ) ) : 0 ; } catch ( java.lang.NumberFormatException e ) { return 0 ; } }
Source:
public static org.ovirt.engine.api.model.Sso map ( org.ovirt.engine.core.common.businessentities.SsoMethod entity , org.ovirt.engine.api.model.Sso template ) { org.ovirt.engine.api.model.Sso model = ( template == null ) ? new org.ovirt.engine.api.model.Sso ( ) : template ; model.setMethods ( new org.ovirt.engine.api.model.Methods ( ) ) ; if ( entity == ( org.ovirt.engine.core.common.businessentities.SsoMethod.GUEST_AGENT ) ) { org.ovirt.engine.api.model.Method method = new org.ovirt.engine.api.model.Method ( ) ; method.setId ( org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT.toString ( ) ) ; model.getMethods ( ) . getMethods ( ) . add ( method ) ; } return model ; }

Target:
public static org.ovirt.engine.api.model.Sso map ( org.ovirt.engine.core.common.businessentities.SsoMethod entity , org.ovirt.engine.api.model.Sso template ) { org.ovirt.engine.api.model.Sso model = ( template == null ) ? new org.ovirt.engine.api.model.Sso ( ) : template ; model.setMethods ( new org.ovirt.engine.api.model.Methods ( ) ) ; if ( entity == ( org.ovirt.engine.core.common.businessentities.SsoMethod.GUEST_AGENT ) ) { org.ovirt.engine.api.model.Method method = new org.ovirt.engine.api.model.Method ( ) ; method.setId ( org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT ) ; model.getMethods ( ) . getMethods ( ) . add ( method ) ; } return model ; }
Source:
protected void syncSearch ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getGlusterSwiftServices ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { setItems ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > ) ( returnValue ) ) ) ; updateActionAvailability ( ) ; } } ) , getEntity ( ) . getId ( ) ) ; }

Target:
protected void syncSearch ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getGlusterSwiftServices ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { setItems ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > ) ( returnValue ) ) ) ; updateActionAvailability ( ) ; } } ) , getEntity ( ) . getId ( ) ) ; }
Source:
private boolean IsAnyBond ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > items ) { for ( org.ovirt.engine.core.common.businessentities.VdsNetworkInterface item : items ) { if ( ( item.getBonded ( ) ) == null ? false : item.getBonded ( ) ) { return true ; } } return false ; }

Target:
private boolean IsAnyBond ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > items ) { for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface item : items ) { if ( ( item.getBonded ( ) ) == null ? false : item.getBonded ( ) ) { return true ; } } return false ; }
Source:
protected org.ovirt.engine.core.common.action.VdcActionParametersBase getParametersForTask ( org.ovirt.engine.core.common.action.VdcActionType actionType , org.ovirt.engine.core.common.action.VdcActionParametersBase parameters ) { org.ovirt.engine.core.common.action.VdcActionType parentCommandType = getParentCommandType ( actionType ) ; org.ovirt.engine.core.common.action.VdcActionParametersBase parentParameters = getParentParameters ( ) ; if ( ( parentCommandType == ( org.ovirt.engine.core.common.action.VdcActionType.Unknown ) ) || ( parentParameters == null ) ) { return parameters ; } parentParameters.setExecutionReason ( parameters.getExecutionReason ( ) ) ; parentParameters.setCommandType ( parentCommandType ) ; return parentParameters ; }

Target:
protected org.ovirt.engine.core.common.action.VdcActionParametersBase getParametersForTask ( org.ovirt.engine.core.common.action.VdcActionType parentCommandType , org.ovirt.engine.core.common.action.VdcActionParametersBase parameters ) { org.ovirt.engine.core.common.action.VdcActionParametersBase parentParameters = parameters.getParentParameters ( ) ; if ( ( parentCommandType == ( org.ovirt.engine.core.common.action.VdcActionType.Unknown ) ) || ( parentParameters == null ) ) { return parameters ; } parentParameters.setExecutionReason ( parameters.getExecutionReason ( ) ) ; parentParameters.setCommandType ( parentCommandType ) ; return parentParameters ; }
Source:
public void diskImagesHasDerivedDisksNoStorageDomainSpecifiedSuccess ( ) { disk1.setVmEntityType ( VmEntityType.TEMPLATE ) ; org.mockito.Mockito.when ( diskImageDao.getAllSnapshotsForParent ( disk1.getImageId ( ) ) ) . thenReturn ( java.util.Collections.emptyList ( ) ) ; org.junit.Assert.assertThat ( validator.diskImagesHaveNoDerivedDisks ( null ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void diskImagesHasDerivedDisksNoStorageDomainSpecifiedSuccess ( ) { disk1.setVmEntityType ( VmEntityType.TEMPLATE ) ; org.junit.Assert.assertThat ( validator.diskImagesHaveNoDerivedDisks ( null ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
protected void ExecuteIrsBrokerCommand ( ) { org.ovirt.engine.core.vdsbroker.irsbroker.ResourceManager.getInstance ( ) . runVdsCommand ( VDSCommandType.ResetIrs , new org.ovirt.engine.core.vdsbroker.irsbroker.ResetIrsVDSCommandParameters ( org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommand.getParameters ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommand.getCurrentIrsProxyData ( ) . getmCurrentIrsHost ( ) , org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommand.getCurrentIrsProxyData ( ) . getCurrentVdsId ( ) ) ) ; }

Target:
protected void ExecuteIrsBrokerCommand ( ) { org.ovirt.engine.core.vdsbroker.irsbroker.ResourceManager.getInstance ( ) . runVdsCommand ( VDSCommandType.ResetIrs , new org.ovirt.engine.core.vdsbroker.irsbroker.ResetIrsVDSCommandParameters ( org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommand.getParameters ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.vdsbroker.irsbroker.SpmStopOnIrsVDSCommand.getCurrentIrsProxyData ( ) . getCurrentVdsId ( ) ) ) ; }
Source:
public void setUsePatternFly ( final boolean use ) { super . setUsePatternFly ( use ) ; if ( use ) { getCheckboxWidgetLabel ( ) . getStyle ( ) . setPaddingLeft ( 10 , Unit.PX ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setPaddingRight ( 10 , Unit.PX ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setPosition ( Position.RELATIVE ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setProperty ( org.ovirt.engine.ui.common.widget.editor.BaseEntityModelCheckboxEditor.MAX_WIDTH , "94%" ) ; noPaddingNoFixes ( ) ; org.ovirt.engine.ui.common.widget.editor.BaseEntityModelCheckboxEditor.removeWrapperStyleName ( org.ovirt.engine.ui.common.widget.editor.BaseEntityModelCheckboxEditor.CBE_RIGHT_OF_LABEL_PFLY_FIX ) ; } }

Target:
public void setUsePatternFly ( final boolean use ) { super . setUsePatternFly ( use ) ; if ( use ) { getCheckboxWidgetLabel ( ) . getStyle ( ) . setPaddingLeft ( 10 , Unit.PX ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setPaddingRight ( 10 , Unit.PX ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setPosition ( Position.RELATIVE ) ; getCheckboxWidgetLabel ( ) . getStyle ( ) . setProperty ( org.ovirt.engine.ui.common.widget.editor.BaseEntityModelCheckboxEditor.MAX_WIDTH , "94%" ) ; noPaddingNoFixes ( ) ; } }
Source:
private void updateActionAvailability ( ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.DiskImage > disks = ( ( getSelectedItems ( ) ) != null ) ? org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.storage.DiskImage > cast ( getSelectedItems ( ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.DiskImage > ( ) ; getRegisterCommand ( ) . setIsExecutionAllowed ( ( ( ( disks.size ( ) ) > 0 ) && ( ( getEntity ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) ) ) ; }

Target:
private void updateActionAvailability ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.Disk > disks = ( ( getSelectedItems ( ) ) != null ) ? getSelectedItems ( ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.Disk > ( ) ; getRegisterCommand ( ) . setIsExecutionAllowed ( ( ( ( disks.size ( ) ) > 0 ) && ( ( getEntity ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) ) ) ; }
Source:
public void validateSuccess ( ) { org.mockito.Mockito.when ( validator.isConnectionExists ( ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( validator.isConnectionForISCSIDomainAttached ( domain ) ) . thenReturn ( java.lang.Boolean.TRUE ) ; org.mockito.Mockito.when ( validator.isISCSIConnectionAndDomain ( domain ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( validator.isDomainOfConnectionExistsAndInactive ( domain ) ) . thenReturn ( ValidationResult.VALID ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }

Target:
public void validateSuccess ( ) { org.mockito.Mockito.when ( validator.isConnectionForISCSIDomainAttached ( domain ) ) . thenReturn ( java.lang.Boolean.TRUE ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }
Source:
public boolean isSearchUsingTags ( ) { return ( ( mOrigText.contains ( "tag" ) ) || ( ( ( getSearchObjectStr ( ) ) != null ) && ( getSearchObjectStr ( ) . equals ( SearchObjects.VDC_USER_OBJ_NAME ) ) ) ) || ( ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME ) ) && ( ( ( getSearchObjectStr ( ) ) == null ) || ( ! ( getSearchObjectStr ( ) . equals ( SearchObjects.VDS_OBJ_NAME ) ) ) ) ) ; }

Target:
public boolean isSearchUsingTags ( ) { return ( ( mOrigText.contains ( "tag" ) ) || ( ( ( getSearchObjectStr ( ) ) != null ) && ( getSearchObjectStr ( ) . equals ( SearchObjects.VDC_USER_OBJ_NAME ) ) ) ) || ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME ) ) ; }
Source:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { getWindow ( ) . stopProgress ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValue = result.getReturnValue ( ) ; if ( ( returnValue != null ) && ( returnValue.getSucceeded ( ) ) ) { setWindow ( null ) ; updateActionsAvailability ( ) ; createUnitVmModelNetworkSucceeded ( returnValue ) ; } else { cancel ( ) ; } super . executed ( result ) ; }

Target:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { getWindow ( ) . stopProgress ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValue = result.getReturnValue ( ) ; if ( ( returnValue != null ) && ( returnValue.getSucceeded ( ) ) ) { setWindow ( null ) ; updateActionsAvailability ( ) ; } else { cancel ( ) ; } super . executed ( result ) ; }
Source:
public static void getClusterNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { if ( ( aQuery.converterCallback ) == null ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } return source ; } } ; } org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllNetworksByClusterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }

Target:
public static void getClusterNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { if ( ( aQuery.converterCallback ) == null ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } return source ; } } ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllNetworksByClusterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }
Source:
private void handleError ( org.ovirt.engine.core.common.businessentities.VDSStatus lastStatus , org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsReturnValue ) { if ( ! ( ( ( org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue ) ( vdsReturnValue.getReturnValue ( ) ) ) . getIsSkipped ( ) ) ) { org.ovirt.engine.core.bll.FenceVdsBaseCommand.setSucceeded ( false ) ; org.ovirt.engine.core.bll.FenceVdsBaseCommand.log.errorFormat ( "Failed to {0} VDS" , org.ovirt.engine.core.bll.FenceVdsBaseCommand.getParameters ( ) . getAction ( ) . name ( ) . toLowerCase ( ) ) ; throw new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.VDS_FENCING_OPERATION_FAILED ) ; } else { setStatus ( lastStatus ) ; } }

Target:
private void handleError ( org.ovirt.engine.core.common.businessentities.VDSStatus lastStatus , final org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsReturnValue ) { if ( ! ( ( ( org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue ) ( vdsReturnValue.getReturnValue ( ) ) ) . getIsSkipped ( ) ) ) { org.ovirt.engine.core.bll.FenceVdsBaseCommand.setSucceeded ( false ) ; org.ovirt.engine.core.bll.FenceVdsBaseCommand.log.errorFormat ( "Failed to {0} VDS" , org.ovirt.engine.core.bll.FenceVdsBaseCommand.getParameters ( ) . getAction ( ) . name ( ) . toLowerCase ( ) ) ; throw new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.VDS_FENCING_OPERATION_FAILED ) ; } else { setStatus ( lastStatus ) ; } }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( target ) ) ; cachedMaxPriority = ( ( java.lang.Integer ) ( returnValue ) ) ; int value = org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getRoundedPriority ( priority , cachedMaxPriority ) ; org.ovirt.engine.ui.uicommonweb.models.EntityModel tempVar = new org.ovirt.engine.ui.uicommonweb.models.EntityModel ( ) ; tempVar.setEntity ( value ) ; before ( callbacks ) ; model.getPriority ( ) . setSelectedItem ( tempVar ) ; after ( callbacks ) ; updatePriority ( callbacks ) ; }

Target:
public void onSuccess ( java.lang.Integer returnValue ) { cachedMaxPriority = returnValue ; int value = org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getRoundedPriority ( priority , cachedMaxPriority ) ; org.ovirt.engine.ui.uicommonweb.models.EntityModel tempVar = new org.ovirt.engine.ui.uicommonweb.models.EntityModel ( ) ; tempVar.setEntity ( value ) ; before ( callbacks ) ; model.getPriority ( ) . setSelectedItem ( tempVar ) ; after ( callbacks ) ; updatePriority ( callbacks ) ; }
Source:
public void testRemoveByName ( ) { dao.removeByName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.EXISTING_VOL_REPL_NAME ) ; java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity > volumes = dao.getByClusterId ( org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.CLUSTER_ID ) ; org.junit.Assert.assertTrue ( ( ( volumes.size ( ) ) == 1 ) ) ; org.junit.Assert.assertTrue ( volumes.contains ( existingDistVol ) ) ; org.junit.Assert.assertFalse ( volumes.contains ( existingReplVol ) ) ; }

Target:
public void testRemoveByName ( ) { dao.removeByName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.EXISTING_VOL_REPL_NAME ) ; java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity > volumes = dao.getByClusterId ( org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoTest.CLUSTER_ID ) ; org.junit.Assert.assertEquals ( 1 , volumes.size ( ) ) ; org.junit.Assert.assertTrue ( volumes.contains ( existingDistVol ) ) ; org.junit.Assert.assertFalse ( volumes.contains ( existingReplVol ) ) ; }
Source:
public static java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > setUpInterfaces ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ifaces = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ( ) ; for ( int i = 0 ; i < ( NAMES.length ) ; i ++ ) { ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getEntitySpecific ( i ) ) ; } ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getMaster ( ) ) ; ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getSlave ( ) ) ; return ifaces ; }

Target:
public static java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > setUpInterfaces ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ifaces = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ( ) ; for ( int i = 0 ; i < ( NAMES.length ) ; i ++ ) { ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getEntitySpecific ( i ) ) ; } ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getMaster ( ) ) ; ifaces.add ( org.ovirt.engine.api.restapi.resource.BackendHostNicsResourceTest.getSlave ( ) ) ; return ifaces ; }
Source:
public void testEmpty ( ) { org.ovirt.engine.core.searchbackend.IAutoCompleter comp = new org.ovirt.engine.core.searchbackend.BitValueAutoCompleter ( ) ; java.util.List < java.lang.String > comps = java.util.Arrays.asList ( comp.getCompletion ( "" ) ) ; org.junit.Assert.assertTrue ( "true" , comps.contains ( "true" ) ) ; org.junit.Assert.assertTrue ( "false" , comps.contains ( "false" ) ) ; org.junit.Assert.assertTrue ( "False" , ( ! ( comps.contains ( "False" ) ) ) ) ; }

Target:
public void testEmpty ( ) { java.util.List < java.lang.String > comps = java.util.Arrays.asList ( comp.getCompletion ( "" ) ) ; org.junit.Assert.assertTrue ( "true" , comps.contains ( "true" ) ) ; org.junit.Assert.assertTrue ( "false" , comps.contains ( "false" ) ) ; org.junit.Assert.assertTrue ( "False" , ( ! ( comps.contains ( "False" ) ) ) ) ; }
Source:
private static void mockStoragePool ( org.ovirt.engine.core.bll.ImportVmTemplateCommand command ) { final org.ovirt.engine.core.dao.StoragePoolDAO dao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDAO.class ) ; final org.ovirt.engine.core.common.businessentities.storage_pool pool = new org.ovirt.engine.core.common.businessentities.storage_pool ( ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( dao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; org.mockito.Mockito.doReturn ( dao ) . when ( command ) . getStoragePoolDAO ( ) ; }

Target:
private static void mockStoragePool ( org.ovirt.engine.core.bll.ImportVmTemplateCommand command ) { final org.ovirt.engine.core.dao.StoragePoolDAO dao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDAO.class ) ; final org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( dao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; org.mockito.Mockito.doReturn ( dao ) . when ( command ) . getStoragePoolDAO ( ) ; }
Source:
public void testGet ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; setUpGetCertuficateExpectations ( ) ; control.replay ( ) ; org.ovirt.engine.api.model.Vm response = resource.get ( ) ; verifyModel ( response , 0 ) ; verifyCertificate ( response ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; setUpGetCertuficateExpectations ( ) ; org.ovirt.engine.api.model.Vm response = resource.get ( ) ; verifyModel ( response , 0 ) ; verifyCertificate ( response ) ; }
Source:
void initEntityModelCellTables ( ) { externalVms.addColumn ( new org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn < org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > > ( ) { @ java.lang.Override public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > externalVmModel ) { return toCellString ( externalVmModel ) ; } } , org.ovirt.engine.ui.webadmin.section.main.view.popup.ImportVmsPopupView.constants.name ( ) ) ; importedVms.addColumn ( new org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn < org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > > ( ) { @ java.lang.Override public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > externalVmModel ) { return toCellString ( externalVmModel ) ; } } , org.ovirt.engine.ui.webadmin.section.main.view.popup.ImportVmsPopupView.constants.name ( ) ) ; }

Target:
void initEntityModelCellTables ( ) { externalVms.addColumn ( new org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn < org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > > ( ) { @ java.lang.Override public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > externalVmModel ) { return externalVmModel.getEntity ( ) . getName ( ) ; } } , org.ovirt.engine.ui.webadmin.section.main.view.popup.ImportVmsPopupView.constants.name ( ) ) ; importedVms.addColumn ( new org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn < org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > > ( ) { @ java.lang.Override public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.businessentities.VM > externalVmModel ) { return externalVmModel.getEntity ( ) . getName ( ) ; } } , org.ovirt.engine.ui.webadmin.section.main.view.popup.ImportVmsPopupView.constants.name ( ) ) ; }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.quota.QuotaModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { java.lang.String lastExecutedCommandName = lastExecutedCommand.getName ( ) ; if ( lastExecutedCommandName == "EditQuotaCluster" ) { return clusterPopupProvider.get ( ) ; } else if ( lastExecutedCommandName == "EditQuotaStorage" ) { return storagePopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.quota.QuotaModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { java.lang.String lastExecutedCommandName = lastExecutedCommand.getName ( ) ; if ( "EditQuotaCluster" . equals ( lastExecutedCommandName ) ) { return clusterPopupProvider.get ( ) ; } else if ( "EditQuotaStorage" . equals ( lastExecutedCommandName ) ) { return storagePopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }
Source:
private void mockVdsDynamicDao ( ) { org.ovirt.engine.core.common.businessentities.VdsDynamic currentVds = new org.ovirt.engine.core.common.businessentities.VdsDynamic ( ) ; currentVds.setId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ; currentVds.setStatus ( VDSStatus.NonResponsive ) ; org.mockito.Mockito.when ( vdsDynamicDao.get ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ) . thenReturn ( currentVds ) ; org.mockito.Mockito.when ( dbFacade.getVdsDynamicDao ( ) ) . thenReturn ( vdsDynamicDao ) ; }

Target:
private void mockVdsDynamicDao ( ) { org.ovirt.engine.core.common.businessentities.VdsDynamic currentVds = new org.ovirt.engine.core.common.businessentities.VdsDynamic ( ) ; currentVds.setId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ; currentVds.setStatus ( VDSStatus.NonResponsive ) ; org.mockito.Mockito.when ( vdsDynamicDao.get ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ) . thenReturn ( currentVds ) ; }
Source:
private boolean restoreInitialState ( ) { org.ovirt.engine.core.compat.Guid statelessVmSnapshotId = getVmSnapshotIdForType ( SnapshotType.STATELESS ) ; if ( statelessVmSnapshotId == null ) { return true ; } java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > statelessDiskSnapshots = getDiskSnapshotsForVmSnapshot ( statelessVmSnapshotId ) ; if ( ! ( detachDisksNotPartOfStatelessSnapshot ( statelessDiskSnapshots ) ) ) { return false ; } if ( ! ( statelessDiskSnapshots.isEmpty ( ) ) ) { return runInternalActionWithTasksContext ( VdcActionType.RestoreAllSnapshots , buildRestoreAllSnapshotsParameters ( statelessDiskSnapshots ) , org.ovirt.engine.core.bll.RestoreStatelessVmCommand.getLock ( ) ) . getSucceeded ( ) ; } return true ; }

Target:
private boolean restoreInitialState ( ) { org.ovirt.engine.core.compat.Guid statelessVmSnapshotId = getVmSnapshotIdForType ( SnapshotType.STATELESS ) ; if ( statelessVmSnapshotId == null ) { return true ; } java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > statelessDiskSnapshots = getDiskSnapshotsForVmSnapshot ( statelessVmSnapshotId ) ; if ( ! ( detachDisksNotPartOfStatelessSnapshot ( statelessDiskSnapshots ) ) ) { return false ; } return runInternalActionWithTasksContext ( VdcActionType.RestoreAllSnapshots , buildRestoreAllSnapshotsParameters ( statelessDiskSnapshots ) , org.ovirt.engine.core.bll.RestoreStatelessVmCommand.getLock ( ) ) . getSucceeded ( ) ; }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.SnapshotModel snapshotModel = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.SnapshotModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.Disk > disks = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.Disk > ) ( returnValue ) ) ; updateSnapshotDisks ( disks ) ; org.ovirt.engine.ui.uicommonweb.models.vms.VmModelHelper.sendWarningForNonExportableDisks ( snapshotModel , disks , VmModelHelper.WarningType.VM_SNAPSHOT ) ; snapshotModel.getCommands ( ) . add ( getOnSaveCommand ( ) ) ; snapshotModel.getCommands ( ) . add ( getCancelCommand ( ) ) ; snapshotModel.stopProgress ( ) ; }

Target:
public void onSuccess ( java.util.List < org.ovirt.engine.core.common.businessentities.storage.Disk > disks ) { updateSnapshotDisks ( disks ) ; org.ovirt.engine.ui.uicommonweb.models.vms.VmModelHelper.sendWarningForNonExportableDisks ( this , disks , VmModelHelper.WarningType.VM_SNAPSHOT ) ; getCommands ( ) . add ( getOnSaveCommand ( ) ) ; getCommands ( ) . add ( getCancelCommand ( ) ) ; stopProgress ( ) ; }
Source:
private void managePrestartedVmsInPool ( org.ovirt.engine.core.common.businessentities.VmPool vmPool ) { org.ovirt.engine.core.compat.Guid vmPoolId = vmPool.getVmPoolId ( ) ; 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.info ( "VmPool '{}' is missing prestarted Vms, attempting to prestart 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.getVmPoolId ( ) ; int prestartedVms = org.ovirt.engine.core.bll.VmPoolCommandBase.getNumOfPrestartedVmsInPool ( vmPoolId , new java.util.ArrayList < java.lang.String > ( ) ) ; 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.info ( "VmPool '{}' is missing prestarted Vms, attempting to prestart Vms" , vmPoolId , missingPrestartedVms , numOfVmsToPrestart ) ; prestartVms ( vmPoolId , numOfVmsToPrestart ) ; } }
Source:
public void testUpdateBootOrder ( ) { org.ovirt.engine.core.common.businessentities.VmDevice vmDevice = dao.get ( getExistingEntityId ( ) ) ; int newBootOrderValue = ( vmDevice.getBootOrder ( ) ) + 1 ; junit.framework.Assert.assertTrue ( org.apache.commons.lang.StringUtils.isNotBlank ( vmDevice.getAddress ( ) ) ) ; vmDevice.setBootOrder ( newBootOrderValue ) ; dao.updateHotPlugDisk ( vmDevice ) ; dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertEquals ( vmDevice.getBootOrder ( ) , newBootOrderValue ) ; }

Target:
public void testUpdateBootOrder ( ) { org.ovirt.engine.core.common.businessentities.VmDevice vmDevice = dao.get ( getExistingEntityId ( ) ) ; int newBootOrderValue = ( vmDevice.getBootOrder ( ) ) + 1 ; org.junit.Assert.assertTrue ( org.apache.commons.lang.StringUtils.isNotBlank ( vmDevice.getAddress ( ) ) ) ; vmDevice.setBootOrder ( newBootOrderValue ) ; dao.updateHotPlugDisk ( vmDevice ) ; dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertEquals ( vmDevice.getBootOrder ( ) , newBootOrderValue ) ; }
Source:
public java.util.Map < java.lang.String , java.lang.String > getVMProperties ( org.ovirt.engine.core.compat.Version version , org.ovirt.engine.core.common.businessentities.VmStatic vmStatic ) { separeteCustomPropertiesToUserAndPredefined ( version , vmStatic ) ; java.util.Map < java.lang.String , java.lang.String > map = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; getPredefinedProperties ( version , vmStatic , map ) ; getUserDefinedProperties ( version , vmStatic , map ) ; return map ; }

Target:
public java.util.Map < java.lang.String , java.lang.String > getPredefinedProperties ( org.ovirt.engine.core.compat.Version version , org.ovirt.engine.core.common.businessentities.VmStatic vmStatic ) { java.util.Map < java.lang.String , java.lang.String > map = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; getPredefinedProperties ( version , vmStatic , map ) ; return map ; }
Source:
public void clusterWithNoCpu ( ) { createCommandWithNoCpuName ( ) ; org.mockito.Mockito.when ( clusterDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateClusterCommandTest.createClusterWithNoCpuName ( ) ) ; org.mockito.Mockito.when ( clusterDao.getByName ( org.mockito.Matchers.anyString ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateClusterCommandTest.createClusterWithNoCpuName ( ) ) ; org.mockito.Mockito.when ( glusterVolumeDao.getByClusterId ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( ) ) ; allQueriesForVms ( ) ; initAndAssertValidation ( true ) ; }

Target:
public void clusterWithNoCpu ( ) { createCommandWithNoCpuName ( ) ; org.mockito.Mockito.when ( clusterDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateClusterCommandTest.createClusterWithNoCpuName ( ) ) ; org.mockito.Mockito.when ( glusterVolumeDao.getByClusterId ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( ) ) ; allQueriesForVms ( ) ; initAndAssertValidation ( true ) ; }
Source:
public void externalVmAreNotSavedAsLastVm ( org.ovirt.engine.core.vdsbroker.VmTestPairs data ) { stubCalls ( data ) ; vmsListFetcher.fetch ( ) ; org.junit.Assume.assumeTrue ( ( ( data.vdsmVm ( ) ) != null ) ) ; org.junit.Assume.assumeTrue ( ( ( data.dbVm ( ) ) == null ) ) ; org.mockito.Mockito.verify ( vdsManager ) . setLastVmsList ( vdsManagerArgumentCaptor.capture ( ) ) ; org.junit.Assert.assertTrue ( ( ( vdsManagerArgumentCaptor.getValue ( ) . size ( ) ) == 0 ) ) ; }

Target:
public void externalVmAreNotSavedAsLastVm ( org.ovirt.engine.core.vdsbroker.VmTestPairs data ) { stubCalls ( data ) ; org.junit.Assert.assertTrue ( vmsListFetcher.fetch ( ) ) ; org.junit.Assume.assumeTrue ( ( ( data.vdsmVm ( ) ) != null ) ) ; org.junit.Assume.assumeTrue ( ( ( data.dbVm ( ) ) == null ) ) ; org.mockito.Mockito.verify ( vdsManager ) . setLastVmsList ( vdsManagerArgumentCaptor.capture ( ) ) ; org.junit.Assert.assertTrue ( ( ( vdsManagerArgumentCaptor.getValue ( ) . size ( ) ) == 0 ) ) ; }
Source:
public void testCannotUpdateOSNotSupportVirtioScsi ( ) { prepareVmToPassValidate ( ) ; group.setCompatibilityVersion ( Version.v3_6 ) ; org.mockito.Mockito.when ( command.isVirtioScsiEnabledForVm ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( org.ovirt.engine.core.bll.UpdateVmCommandTest.osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( java.util.Collections.singletonList ( "VirtIO" ) ) ; command.initEffectiveCompatibilityVersion ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI ) ; }

Target:
public void testCannotUpdateOSNotSupportVirtioScsi ( ) { prepareVmToPassValidate ( ) ; group.setCompatibilityVersion ( Version.v3_6 ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . isVirtioScsiEnabledForVm ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.when ( org.ovirt.engine.core.bll.UpdateVmCommandTest.osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( java.util.Collections.singletonList ( "VirtIO" ) ) ; command.initEffectiveCompatibilityVersion ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI ) ; }
Source:
public javax.ws.rs.core.Response remove ( ) { get ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection.setId ( id ) ; org.ovirt.engine.core.compat.Guid hostId = org.ovirt.engine.core.compat.Guid.Empty ; org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( connection , hostId ) ; return performAction ( VdcActionType.RemoveStorageServerConnection , parameters ) ; }

Target:
public javax.ws.rs.core.Response remove ( ) { get ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections connection = new org.ovirt.engine.core.common.businessentities.StorageServerConnections ( ) ; connection.setId ( id ) ; org.ovirt.engine.core.compat.Guid hostId = org.ovirt.engine.core.compat.Guid.Empty ; org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( connection , hostId , false ) ; return performAction ( VdcActionType.RemoveStorageServerConnection , parameters ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.VDS > filter ( java.util.List < org.ovirt.engine.core.common.businessentities.VDS > hosts , org.ovirt.engine.core.common.businessentities.VM vm , java.util.Map < java.lang.String , java.lang.String > parameters , java.util.List < java.lang.String > messages ) { if ( ( vm.getMigrationSupport ( ) ) == ( org.ovirt.engine.core.common.businessentities.MigrationSupport.PINNED_TO_HOST ) ) { for ( org.ovirt.engine.core.common.businessentities.VDS host : hosts ) { if ( host.getId ( ) . equals ( vm.getDedicatedVmForVds ( ) ) ) { return java.util.Arrays.asList ( host ) ; } } } return hosts ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.VDS > filter ( java.util.List < org.ovirt.engine.core.common.businessentities.VDS > hosts , org.ovirt.engine.core.common.businessentities.VM vm , java.util.Map < java.lang.String , java.lang.String > parameters , java.util.List < java.lang.String > messages ) { if ( ( vm.getMigrationSupport ( ) ) == ( org.ovirt.engine.core.common.businessentities.MigrationSupport.PINNED_TO_HOST ) ) { for ( org.ovirt.engine.core.common.businessentities.VDS host : hosts ) { if ( host.getId ( ) . equals ( vm.getDedicatedVmForVds ( ) ) ) { return java.util.Arrays.asList ( host ) ; } } return new java.util.ArrayList < > ( ) ; } return hosts ; }
Source:
private void prepareMocks ( ) { org.mockito.Mockito.doReturn ( storagePoolIsoMapDao ) . when ( command ) . getStoragePoolIsoMapDao ( ) ; org.mockito.Mockito.doReturn ( null ) . when ( command ) . findConnectionWithSameDetails ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.StorageServerConnections.class ) ) ; org.mockito.Mockito.doReturn ( lunDao ) . when ( command ) . getLunDao ( ) ; org.mockito.Mockito.doReturn ( vmDao ) . when ( command ) . getVmDao ( ) ; }

Target:
private void prepareMocks ( ) { org.mockito.Mockito.doReturn ( storagePoolIsoMapDao ) . when ( command ) . getStoragePoolIsoMapDao ( ) ; org.mockito.Mockito.doReturn ( null ) . when ( command ) . findConnectionWithSameDetails ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.StorageServerConnections.class ) ) ; org.mockito.Mockito.doReturn ( vmDao ) . when ( command ) . getVmDao ( ) ; }
Source:
public void Executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { if ( ! ( result.getReturnValue ( ) . getSucceeded ( ) ) ) { return ; } org.ovirt.engine.ui.uicommonweb.models.userportal.PoolItemBehavior behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.PoolItemBehavior ) ( result.getState ( ) ) ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValueBase = result.getReturnValue ( ) ; org.ovirt.engine.core.compat.Guid Guid = ( ( org.ovirt.engine.core.compat.Guid ) ( returnValueBase.getActionReturnValue ( ) ) ) ; behavior.PostTakeVm ( Guid ) ; }

Target:
public void Executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { if ( ! ( result.getReturnValue ( ) . getSucceeded ( ) ) ) { return ; } org.ovirt.engine.ui.uicommonweb.models.userportal.PoolItemBehavior behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.PoolItemBehavior ) ( result.getState ( ) ) ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase returnValueBase = result.getReturnValue ( ) ; org.ovirt.engine.core.compat.Guid Guid = ( ( org.ovirt.engine.core.compat.Guid ) ( returnValueBase.getActionReturnValue ( ) ) ) ; }