auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init ( ) { mockCpuFlagsManagerHandler ( ) ; org.ovirt.engine.core.bll.VmHandler.init ( ) ; mockVmPropertiesUtils ( ) ; org.mockito.Mockito.doNothing ( ) . when ( vmPropertiesUtils ) . separateCustomPropertiesToUserAndPredefined ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VmStatic.class ) ) ; }

Target:
public void init ( ) { mockCpuFlagsManagerHandler ( ) ; vmHandler.init ( ) ; mockVmPropertiesUtils ( ) ; org.mockito.Mockito.doNothing ( ) . when ( vmPropertiesUtils ) . separateCustomPropertiesToUserAndPredefined ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VmStatic.class ) ) ; }
Source:
public void canDoActionFailedVirtIODisk ( ) throws java.lang.Exception { mockVmStatusUp ( ) ; mockSpiceSupportMatrix ( ) ; org.mockito.Mockito.when ( osRepository.getOsName ( 0 ) ) . thenReturn ( "RHEL6" ) ; createNotVirtIODisk ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.HOT_PLUG_DISK_IS_NOT_VIRTIO.toString ( ) ) ) ; }

Target:
public void canDoActionFailedVirtIODisk ( ) throws java.lang.Exception { mockVmStatusUp ( ) ; mockInterfaceList ( ) ; org.mockito.Mockito.when ( osRepository.getOsName ( 0 ) ) . thenReturn ( "RHEL6" ) ; createNotVirtIODisk ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED.toString ( ) ) ) ; }
Source:
public void validateFailsWithDuplicateVolumeName ( ) { cmd = org.mockito.Mockito.spy ( createTestCommand ( getVolume ( 2 , false ) ) ) ; prepareMocks ( cmd ) ; org.mockito.Mockito.doReturn ( getVolume ( 2 , false ) ) . when ( volumeDao ) . getByName ( clusterId , "vol1" ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NAME_ALREADY_EXISTS ) ; }

Target:
public void validateFailsWithDuplicateVolumeName ( ) { org.mockito.Mockito.doReturn ( getVolume ( 2 , false ) ) . when ( volumeDao ) . getByName ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeCommandTest.clusterId , "vol1" ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NAME_ALREADY_EXISTS ) ; }
Source:
void localize ( org.ovirt.engine.ui.userportal.ApplicationConstants constants ) { headerLabel.setText ( constants.loginHeaderLabel ( ) ) ; userNameEditor.setLabel ( constants.loginFormUserNameLabel ( ) ) ; passwordEditor.setLabel ( constants.loginFormPasswordLabel ( ) ) ; domainEditor.setLabel ( constants.loginFormDomainLabel ( ) ) ; connectAutomatically.setLabel ( constants.loginFormConnectAutomaticallyLabel ( ) ) ; loginButton.setLabel ( constants.loginButtonLabel ( ) ) ; }

Target:
private void addStyles ( ) { userNameEditor.hideLabel ( ) ; passwordEditor.hideLabel ( ) ; domainEditor.hideLabel ( ) ; }
Source:
public java.util.Map < java.lang.String , java.lang.String > getJobMessageProperties ( ) { if ( ( jobProperties ) == null ) { jobProperties = super . getJobMessageProperties ( ) ; org.ovirt.engine.core.common.businessentities.Snapshot snapshot = getSnapshotDao ( ) . get ( org.ovirt.engine.core.bll.RestoreAllSnapshotsCommand.getParameters ( ) . getDstSnapshotId ( ) ) ; if ( snapshot != null ) { jobProperties.put ( VdcObjectType.Snapshot.name ( ) . toLowerCase ( ) , snapshot.getDescription ( ) ) ; } } return jobProperties ; }

Target:
public java.util.Map < java.lang.String , java.lang.String > getJobMessageProperties ( ) { if ( ( jobProperties ) == null ) { jobProperties = super . getJobMessageProperties ( ) ; org.ovirt.engine.core.common.businessentities.Snapshot snapshot = getSnapshotDao ( ) . get ( getSnapshotId ( ) ) ; if ( snapshot != null ) { jobProperties.put ( VdcObjectType.Snapshot.name ( ) . toLowerCase ( ) , snapshot.getDescription ( ) ) ; } } return jobProperties ; }
Source:
public static java.lang.String combine ( java.lang.String head , java.util.List < org.ovirt.engine.api.model.ParametersSet > params ) { java.lang.String combined_params = "" ; if ( params != null ) { for ( org.ovirt.engine.api.model.ParametersSet ps : params ) { for ( org.ovirt.engine.api.model.Parameter param : ps.getParameters ( ) ) { combined_params += java.lang.String.format ( org.ovirt.engine.api.common.util.LinkHelper.PARAMETER_TEMPLATE , param.getName ( ) , param.getValue ( ) ) ; } } } return head + combined_params ; }

Target:
public static java.lang.String combine ( java.lang.String head , java.util.List < org.ovirt.engine.api.model.ParametersSet > params ) { java.lang.String combined_params = "" ; if ( params != null ) { for ( org.ovirt.engine.api.model.ParametersSet ps : params ) { for ( org.ovirt.engine.api.model.Parameter param : ps.getParameters ( ) ) { combined_params += java.lang.String.format ( org.ovirt.engine.api.common.util.LinkHelper.MATRIX_PARAMETER_TEMPLATE , param.getName ( ) , param.getValue ( ) ) ; } } } return head + combined_params ; }
Source:
public void addTag ( org.ovirt.engine.core.common.businessentities.Tags tag ) { if ( tagsMapByID.containsKey ( tag.getparent_id ( ) ) ) { org.ovirt.engine.core.common.businessentities.Tags parent = tagsMapByID.get ( tag.getparent_id ( ) ) ; parent.getChildren ( ) . add ( tag ) ; addTagToHash ( tag ) ; addTagToHash ( parent ) ; } else { org.ovirt.engine.core.bll.TagsDirector.log.errorFormat ( "Trying to add tag {0}, parent doesn't exist in Data Structure - {1}" , tag.gettag_name ( ) , tag.getparent_id ( ) ) ; } }

Target:
public void addTag ( org.ovirt.engine.core.common.businessentities.Tags tag ) { if ( tagsMapByID.containsKey ( tag.getparent_id ( ) ) ) { org.ovirt.engine.core.common.businessentities.Tags parent = tagsMapByID.get ( tag.getparent_id ( ) ) ; parent.getChildren ( ) . add ( tag ) ; addTagToHash ( tag ) ; addTagToHash ( parent ) ; } else { org.ovirt.engine.core.bll.TagsDirector.log.error ( "Trying to add tag '{}', parent doesn't exist in Data Structure - '{}'" , tag.gettag_name ( ) , tag.getparent_id ( ) ) ; } }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > ) ( returnValue ) ) ; allNetworks = networks ; initNetworkModels ( ) ; initDcNetworkParams ( ) ; queryInterfaces ( ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValueObj ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValueObj ) ) ; java.lang.Object returnValue2 = returnValue.getReturnValue ( ) ; this . allNics = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ) ( returnValue2 ) ) ; queryNetworkAttachments ( ) ; }
Source:
public boolean isPmReportsStatusDown ( ) { boolean result = false ; org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.bll.VdsCommand.getVds ( ) ; org.ovirt.engine.core.common.vdscommands.VDSFenceReturnValue returnValue = null ; if ( ( vds != null ) && ( vds.isPmEnabled ( ) ) ) { org.ovirt.engine.core.bll.FenceExecutor executor = new org.ovirt.engine.core.bll.FenceExecutor ( vds ) ; returnValue = executor.checkStatus ( ) ; result = org.ovirt.engine.core.bll.VdsCommand.isHostStatusOff ( returnValue ) ; } if ( result ) { runVdsCommand ( VDSCommandType.SetVdsStatus , new org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters ( org.ovirt.engine.core.bll.VdsCommand.getVds ( ) . getId ( ) , org.ovirt.engine.core.common.businessentities.VDSStatus.Down ) ) ; } return result ; }

Target:
protected void testVdsPowerManagementStatus ( org.ovirt.engine.core.common.businessentities.VdsStatic vdsStatic ) { if ( vdsStatic.isPmEnabled ( ) ) { org.ovirt.engine.core.bll.pm.PmHealthCheckManager.getInstance ( ) . pmHealthCheck ( vdsStatic.getId ( ) ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.StorageServerConnections getStorageServerConnection ( java.lang.String id ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue result = runQuery ( QueryType.GetStorageServerConnectionById , new org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase ( id ) ) ; if ( ( result.getSucceeded ( ) ) && ( ( result.getReturnValue ( ) ) != null ) ) { return ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( result.getReturnValue ( ) ) ) ; } throw new org.ovirt.engine.api.restapi.resource.WebFaultException ( null , ( ( "Can't find storage server connection for id '" + id ) + "'." ) , javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.StorageServerConnections getStorageServerConnection ( java.lang.String id ) { org.ovirt.engine.core.common.queries.QueryReturnValue result = runQuery ( QueryType.GetStorageServerConnectionById , new org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase ( id ) ) ; if ( ( result.getSucceeded ( ) ) && ( ( result.getReturnValue ( ) ) != null ) ) { return ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( result.getReturnValue ( ) ) ) ; } throw new org.ovirt.engine.api.restapi.resource.WebFaultException ( null , ( ( "Can't find storage server connection for id '" + id ) + "'." ) , javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR ) ; }
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 ) ) ; org.ovirt.engine.core.common.businessentities.VmTemplate template = ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( returnValue ) ) ; if ( useLatest ) { template = createLatestTemplate ( template ) ; } setupBaseTemplate ( template.getBaseTemplateId ( ) ) ; model.getTemplate ( ) . setItems ( java.util.Collections.singletonList ( template ) ) ; model.getTemplate ( ) . setSelectedItem ( template ) ; model.getTemplate ( ) . setIsChangable ( false ) ; }

Target:
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 ) ) ; org.ovirt.engine.core.common.businessentities.VmTemplate template = ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( returnValue ) ) ; if ( useLatest ) { template = new org.ovirt.engine.ui.uicommonweb.models.templates.LatestVmTemplate ( template ) ; } setupBaseTemplate ( template.getBaseTemplateId ( ) ) ; model.getTemplate ( ) . setItems ( java.util.Collections.singletonList ( template ) ) ; model.getTemplate ( ) . setSelectedItem ( template ) ; model.getTemplate ( ) . setIsChangable ( false ) ; }
Source:
private void handleActionWithKey ( java.lang.String action , java.lang.String key ) { engineConfigMap.setConfigAction ( org.ovirt.engine.core.config.validation.ConfigActionType.getActionType ( action ) ) ; if ( action.equals ( "--get" ) ) { engineConfigMap.setKey ( key ) ; } else { org.ovirt.engine.core.config.EngineConfigCLIParser.log.debug ( "parseAction error: first argument is illegal." ) ; throw new java.lang.IllegalArgumentException ( ( ( ( ( "Action verb must come first, and '" + action ) + '=' ) + key ) + "\' is not an action.\nPlease tell me what to do: list? get? set? get-all?" ) ) ; } }

Target:
private void handleActionWithKey ( java.lang.String action , java.lang.String key ) { engineConfigMap.setConfigAction ( org.ovirt.engine.core.config.validation.ConfigActionType.getActionType ( action ) ) ; if ( ( action.equals ( "--get" ) ) || ( action.equals ( "--help" ) ) ) { engineConfigMap.setKey ( key ) ; } else { org.ovirt.engine.core.config.EngineConfigCLIParser.log.debug ( "parseAction error: first argument is illegal." ) ; throw new java.lang.IllegalArgumentException ( ( ( ( ( "Action verb must come first, and '" + action ) + '=' ) + key ) + "\' is not an action.\nPlease tell me what to do: list? get? set? get-all?" ) ) ; } }
Source:
public static org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface setUpStatistics ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface entity , org.ovirt.engine.core.compat.Guid id ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics statistics = new org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics ( ) ; statistics.setId ( null ) ; statistics.setReceiveDropRate ( 1.0 ) ; statistics.setReceiveRate ( 2.0 ) ; statistics.setTransmitDropRate ( 3.0 ) ; statistics.setTransmitRate ( 4.0 ) ; statistics.setVdsId ( id ) ; statistics.setStatus ( null ) ; entity.setStatistics ( statistics ) ; return entity ; }

Target:
public static org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface setUpStatistics ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface entity , org.ovirt.engine.core.compat.Guid id ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics statistics = new org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics ( ) ; statistics.setId ( null ) ; statistics.setReceiveDropRate ( 1.0 ) ; statistics.setReceiveRate ( 2.0 ) ; statistics.setTransmitDropRate ( 3.0 ) ; statistics.setTransmitRate ( 4.0 ) ; statistics.setReceivedBytes ( 5L ) ; statistics.setTransmittedBytes ( 6L ) ; statistics.setVdsId ( id ) ; statistics.setStatus ( null ) ; entity.setStatistics ( statistics ) ; return entity ; }
Source:
public void diskImagesAlreadyExistBothExist ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ) . when ( validator ) . getExistingDisk ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.junit.Assert.assertThat ( validator.diskImagesAlreadyExist ( ) , org.hamcrest.CoreMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST ) ) . and ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.replacements ( org.hamcrest.CoreMatchers.hasItem ( org.ovirt.engine.core.bll.validator.storage.DiskImagesValidatorTest.createAliasReplacements ( disk1 , disk2 ) ) ) ) ) ; }

Target:
public void diskImagesAlreadyExistBothExist ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) . when ( validator ) . getExistingDisk ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.junit.Assert.assertThat ( validator.diskImagesAlreadyExist ( ) , org.hamcrest.CoreMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST ) ) . and ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.replacements ( org.hamcrest.CoreMatchers.hasItem ( org.ovirt.engine.core.bll.validator.storage.DiskImagesValidatorTest.createAliasReplacements ( disk1 , disk2 ) ) ) ) ) ; }
Source:
public void Executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { sourceListModel.getSearchCommand ( ) . Execute ( ) ; }

Target:
private void onSave ( ) { if ( ! ( validate ( ) ) ) { return ; } provider.setName ( ( ( java.lang.String ) ( privateName.getEntity ( ) ) ) ) ; provider.setDescription ( ( ( java.lang.String ) ( privateDescription.getEntity ( ) ) ) ) ; provider.setUrl ( ( ( java.lang.String ) ( privateUrl.getEntity ( ) ) ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( action , new org.ovirt.engine.core.common.action.ProviderParameters ( provider ) ) ; cancel ( ) ; }
Source:
public void getVmNextRunConfiguration ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmNextRunConfiguration , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }

Target:
public void getVmNextRunConfiguration ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmNextRunConfiguration , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
public java.util.List < org.ovirt.api.metamodel.concepts.Attribute > getDeclaredAttributes ( ) { return new java.util.ArrayList ( attributes ) ; }

Target:
public java.util.stream.Stream < org.ovirt.api.metamodel.concepts.Attribute > attributes ( ) { java.util.stream.Stream < org.ovirt.api.metamodel.concepts.Attribute > result = declaredAttributes ( ) ; if ( ( ( base ) != null ) && ( ( base ) instanceof org.ovirt.api.metamodel.concepts.StructType ) ) { result = java.util.stream.Stream.concat ( result , ( ( org.ovirt.api.metamodel.concepts.StructType ) ( base ) ) . attributes ( ) ) ; } return result ; }
Source:
public boolean isSearchUsingTags ( ) { return ( ( ( origText.contains ( "tag" ) ) || ( ( ( getSearchObjectStr ( ) ) != null ) && ( getSearchObjectStr ( ) . equals ( SearchObjects.VDC_USER_OBJ_NAME ) ) ) ) || ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_POOL_OBJ_NAME ) ) ) || ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME ) ) ; }

Target:
public boolean isSearchUsingTags ( ) { return ( ( ( origText.contains ( "tag" ) ) || ( isUserSearchUsingTags ( ) ) ) || ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_POOL_OBJ_NAME ) ) ) || ( getCrossRefObjList ( ) . contains ( SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME ) ) ; }
Source:
protected java.lang.String [ ] getSubCollections ( ) { java.lang.Class < ? > [ ] interfaces = getClass ( ) . getInterfaces ( ) ; java.util.List < java.lang.String > subCollections = new java.util.ArrayList < > ( ) ; for ( java.lang.Class < ? > clazz : interfaces ) { org.ovirt.engine.api.rsdl.ServiceTreeNode node = getRequiredNode ( clazz ) ; if ( node != null ) { org.ovirt.engine.api.restapi.resource.AbstractBackendResource.addSubCollections ( node , subCollections ) ; } } return ( ( java.lang.String [ ] ) ( subCollections.toArray ( new java.lang.String [ 0 ] ) ) ) ; }

Target:
protected java.lang.String [ ] getSubCollections ( ) { java.util.Set < java.lang.Class < ? > > interfaces = getInterfaces ( ) ; java.util.List < java.lang.String > subCollections = new java.util.ArrayList < > ( ) ; for ( java.lang.Class < ? > clazz : interfaces ) { org.ovirt.engine.api.rsdl.ServiceTreeNode node = getRequiredNode ( clazz ) ; if ( node != null ) { org.ovirt.engine.api.restapi.resource.AbstractBackendResource.addSubCollections ( node , subCollections ) ; } } return subCollections.toArray ( new java.lang.String [ 0 ] ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.Network > getAll ( ) { java.util.Map < java.lang.String , java.lang.Object > dbResults = dialect.createJdbcCallForQuery ( jdbcTemplate ) . withProcedureName ( "GetAllFromnetwork" ) . returningResultSet ( "RETURN_VALUE" , org.ovirt.engine.core.dao.NetworkDAODbFacadeImpl.NetworkRowMapper.instance ) . execute ( getCustomMapSqlParameterSource ( ) ) ; return ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Network > ) ( dbResults.get ( "RETURN_VALUE" ) ) ) ; }

Target:
public org.ovirt.engine.core.common.businessentities.Network getByNameAndCluster ( java.lang.String name , org.ovirt.engine.core.compat.Guid clusterId ) { return getCallsHandler ( ) . executeRead ( "GetNetworkByNameAndCluster" , org.ovirt.engine.core.dao.NetworkDAODbFacadeImpl.NetworkRowMapper.instance , getCustomMapSqlParameterSource ( ) . addValue ( "name" , name ) . addValue ( "cluster_id" , clusterId ) ) ; }
Source:
public static void getAttachedTagsToVm ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.setAttachedTagsConverter ( aQuery ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetTagsByVmId , new org.ovirt.engine.core.common.queries.GetTagsByVmIdParameters ( id.toString ( ) ) , aQuery ) ; }

Target:
public static void getStorageDomainList ( 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.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ( ) ; } } ; org.ovirt.engine.core.common.queries.SearchParameters searchParams = new org.ovirt.engine.core.common.queries.SearchParameters ( "Storage:" , org.ovirt.engine.core.common.interfaces.SearchType.StorageDomain ) ; searchParams.setMaxCount ( 9999 ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.Search , searchParams , aQuery ) ; }
Source:
public boolean validate ( ) { return super . validate ( ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.NewTemplateVmModelBehavior behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.NewTemplateVmModelBehavior ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > templates = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > ) ( returnValue ) ) ; behavior.postInitTemplate ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.filterTemplatesByArchitecture ( templates , dataCenterWithCluster.getCluster ( ) . getArchitecture ( ) ) ) ; }
Source:
public static void getStorageDomainMaxNameLength ( 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 ( ) : 1 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.StorageDomainNameSizeLimit , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public static void getNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
public void testUpdateFieldsName ( ) { org.ovirt.engine.core.common.businessentities.VmTemplate src = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; src.setName ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.ovirt.engine.core.common.businessentities.VmTemplate dest = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; dest.setName ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.junit.Assert.assertTrue ( "Update should be valid for different names" , org.ovirt.engine.core.bll.VmTemplateHandler.isUpdateValid ( src , dest ) ) ; }

Target:
public void testUpdateFieldsName ( ) { org.ovirt.engine.core.common.businessentities.VmTemplate src = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; src.setName ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.ovirt.engine.core.common.businessentities.VmTemplate dest = new org.ovirt.engine.core.common.businessentities.VmTemplate ( ) ; dest.setName ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; org.junit.Assert.assertTrue ( "Update should be valid for different names" , vmTemplateHandler.isUpdateValid ( src , dest ) ) ; }
Source:
private org.ovirt.engine.core.bll.ValidationResult nicActuallyExistsOrReferencesNewBond ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment ) { boolean nicActuallyExistsOrReferencesNewBond = isNicActuallyExistsOrReferencesNewBond ( attachment.getNicName ( ) , attachment.getNicId ( ) ) ; if ( nicActuallyExistsOrReferencesNewBond ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST ) ; }

Target:
private org.ovirt.engine.core.bll.ValidationResult modifiedAttachmentExists ( org.ovirt.engine.core.compat.Guid networkAttachmentId ) { boolean doesNotReferenceExistingNetworkAttachment = networkAttachmentId == null ; if ( doesNotReferenceExistingNetworkAttachment ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } for ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment existingAttachment : existingAttachments ) { if ( existingAttachment.getId ( ) . equals ( networkAttachmentId ) ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } } return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_ATTACHMENT_NOT_EXISTS , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidator.VAR_NETWORK_ATTACHMENT_NOT_EXISTS_ENTITY , networkAttachmentId.toString ( ) ) ) ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult isDomainHasNoImages ( org.ovirt.engine.core.common.errors.VdcBllMessages message , boolean allowOvfDisk ) { int numOfAllowedDisks = 0 ; if ( allowOvfDisk ) { numOfAllowedDisks = getDbFacade ( ) . getStorageDomainOvfInfoDao ( ) . getAllForDomain ( storageDomain.getId ( ) ) . size ( ) ; } if ( ( getDbFacade ( ) . getDiskImageDao ( ) . getAllSnapshotsForStorageDomain ( storageDomain.getId ( ) ) . size ( ) ) > numOfAllowedDisks ) { return new org.ovirt.engine.core.bll.ValidationResult ( message ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult isDomainExist ( ) { if ( ( storageDomain ) == null ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { java.lang.String propName = args.propertyName ; if ( "IsChangable" . equals ( propName ) ) { sysprepPasswordSetEditor.setTitle ( ( model.getSysprepPasswordSet ( ) . getIsChangable ( ) ? org.ovirt.engine.ui.common.widget.uicommon.popup.vm.VmInitWidget.constants.vmInitPasswordSetToolTip ( ) : org.ovirt.engine.ui.common.widget.uicommon.popup.vm.VmInitWidget.constants.vmInitPasswordNotSetToolTip ( ) ) ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { java.lang.String propName = args.propertyName ; if ( "IsChangable" . equals ( propName ) ) { sysprepPasswordSetEditor.setWidgetTooltip ( ( model.getSysprepPasswordSet ( ) . getIsChangable ( ) ? org.ovirt.engine.ui.common.widget.uicommon.popup.vm.VmInitWidget.constants.vmInitPasswordSetToolTip ( ) : org.ovirt.engine.ui.common.widget.uicommon.popup.vm.VmInitWidget.constants.vmInitPasswordNotSetToolTip ( ) ) ) ; } }
Source:
protected boolean checkRemoveEditValidations ( ) { org.ovirt.engine.core.compat.Guid clusterPolicyId = getParameters ( ) . getClusterPolicyId ( ) ; if ( clusterPolicyId == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } org.ovirt.engine.core.common.scheduling.ClusterPolicy clusterPolicy = org.ovirt.engine.core.bll.scheduling.SchedulingManager.getInstance ( ) . getClusterPolicy ( clusterPolicyId ) ; if ( clusterPolicy == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } if ( clusterPolicy.isLocked ( ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } return true ; }

Target:
protected boolean checkRemoveEditValidations ( ) { org.ovirt.engine.core.compat.Guid clusterPolicyId = getParameters ( ) . getClusterPolicyId ( ) ; if ( clusterPolicyId == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } org.ovirt.engine.core.common.scheduling.ClusterPolicy clusterPolicy = org.ovirt.engine.core.bll.scheduling.SchedulingManager.getInstance ( ) . getClusterPolicy ( clusterPolicyId ) ; if ( clusterPolicy == null ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } if ( clusterPolicy.isLocked ( ) ) { return failCanDoAction ( EngineMessage.ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID ) ; } return true ; }
Source:
public void bridgePropertiesNonVm ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = createManagementNetwork ( ) ; network.setVmNetwork ( false ) ; mockExistingNetworks ( network ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNicSyncedWithNetwork ( "eth0" , network ) ; mockExistingIfaces ( iface ) ; iface.setCustomProperties ( createCustomProperties ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( iface ) , Version.v3_5 ) ; validateAndExpectViolation ( helper , VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; }

Target:
public void bridgePropertiesNonVm ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = createManagementNetwork ( ) ; network.setVmNetwork ( false ) ; mockExistingNetworks ( network ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNicSyncedWithNetwork ( "eth0" , network ) ; mockExistingIfaces ( iface ) ; iface.setCustomProperties ( createCustomProperties ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( iface ) , Version.v3_5 ) ; validateAndExpectViolation ( helper , EngineMessage.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.MANAGEMENT_NETWORK_NAME ) ; }
Source:
public void validateVmInPreview ( ) { createParameters ( ) ; initDiskImage ( diskImageGroupId , diskImageId ) ; initVm ( VMStatus.Up , null , diskImageId ) ; setVmInPreview ( true ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ) . when ( snapshotsValidator ) . vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ; }

Target:
public void validateFailsWhenCreateAllSnapshotFromVmValidationFails ( ) { createParameters ( srcStorageId , dstStorageId ) ; org.ovirt.engine.core.common.businessentities.StorageDomain srcStorageDomain = initStorageDomain ( srcStorageId ) ; srcStorageDomain.setStatus ( StorageDomainStatus.Active ) ; org.ovirt.engine.core.common.businessentities.StorageDomain dstStorageDomain = initStorageDomain ( dstStorageId ) ; dstStorageDomain.setStatus ( StorageDomainStatus.Active ) ; initDiskImage ( diskImageGroupId , diskImageId ) ; initVm ( VMStatus.Up , org.ovirt.engine.core.compat.Guid.newGuid ( ) , diskImageGroupId ) ; org.mockito.Mockito.doReturn ( false ) . when ( command ) . validateCreateAllSnapshotsFromVmCommand ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }
Source:
public static < T extends java.lang.Comparable < T > > java.util.ArrayList < T > OrderByDescending ( java.util.List < T > source ) { java.util.ArrayList < T > list = new java.util.ArrayList < T > ( ) ; java.util.ArrayList < T > sorted = new java.util.ArrayList < T > ( source ) ; java.util.Collections.sort ( sorted ) ; for ( int i = sorted.size ( ) ; i > 0 ; i -- ) { list.add ( sorted.get ( ( i - 1 ) ) ) ; } return list ; }

Target:
public static < T extends java.lang.Comparable < T > > java.util.ArrayList < T > orderByDescending ( java.util.List < T > source ) { java.util.ArrayList < T > list = new java.util.ArrayList < T > ( ) ; java.util.ArrayList < T > sorted = new java.util.ArrayList < T > ( source ) ; java.util.Collections.sort ( sorted ) ; for ( int i = sorted.size ( ) ; i > 0 ; i -- ) { list.add ( sorted.get ( ( i - 1 ) ) ) ; } return list ; }
Source:
public void wakeup ( ) { this . affinityGroupDao = _affinityGroupDao ; this . vmDao = _vmDao ; this . vdsDao = _vdsDao ; this . vdsGroupDao = _vdsGroupDao ; super . wakeup ( ) ; }

Target:
public void wakeup ( ) { this . auditLogDirector = _auditLogDirector ; this . vdsDao = _vdsDao ; this . vdsGroupDao = _vdsGroupDao ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.scheduling.AffinityRulesEnforcementManagerTest.TestingAffinityRulesEnforcementPerCluster ( ) ) . when ( _perClusterProvider ) . get ( ) ; this . perClusterProvider = _perClusterProvider ; super . wakeup ( ) ; addInjectionsToPerClusterObjects ( ) ; }
Source:
protected void setUpGetEntityExpectations ( int index ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.LdapGroup user = org.ovirt.engine.api.restapi.resource.BackendGroupsResourceTest.setUpEntityExpectations ( control.createMock ( org.ovirt.engine.core.common.businessentities.LdapGroup.class ) , index ) ; setUpGetEntityExpectations ( ( ( "ADGROUP@" + ( DOMAIN ) ) + ": name=*" ) , SearchType.AdGroup , user ) ; }

Target:
private void setUpEntityQueryExpectations ( int index , boolean notFound ) throws java.lang.Exception { setUpGetEntityExpectations ( VdcQueryType.GetDirectoryGroupById , org.ovirt.engine.core.common.queries.DirectoryIdQueryParameters.class , new java.lang.String [ ] { "Domain" , "Id" } , new java.lang.Object [ ] { DOMAIN , GUIDS [ index ] } , ( notFound ? null : getEntity ( index ) ) ) ; }
Source:
private void setUpGetEntityExpectations ( org.ovirt.engine.core.compat.Guid entityId , boolean returnNull ) throws java.lang.Exception { java.lang.String [ ] names = new java.lang.String [ ] { "Id" } ; java.lang.Object [ ] values = new java.lang.Object [ ] { entityId } ; org.ovirt.engine.core.common.businessentities.tags tag = null ; if ( ! returnNull ) { tag = new org.ovirt.engine.core.common.businessentities.tags ( ) ; tag.settag_id ( entityId ) ; } setUpGetEntityExpectations ( VdcQueryType.GetTagByTagId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , names , values , tag ) ; }

Target:
private void setUpGetEntityExpectations ( org.ovirt.engine.core.compat.Guid entityId , boolean returnNull ) throws java.lang.Exception { java.lang.String [ ] names = new java.lang.String [ ] { "Id" } ; java.lang.Object [ ] values = new java.lang.Object [ ] { entityId } ; org.ovirt.engine.core.common.businessentities.Tags tag = null ; if ( ! returnNull ) { tag = new org.ovirt.engine.core.common.businessentities.Tags ( ) ; tag.settag_id ( entityId ) ; } setUpGetEntityExpectations ( VdcQueryType.GetTagByTagId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , names , values , tag ) ; }
Source:
public static void GetTemplateById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid templateId ) { 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.GetVmTemplate , new org.ovirt.engine.core.common.queries.GetVmTemplateParameters ( templateId ) , aQuery ) ; }

Target:
public static void GetRpmVersionViaPublic ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunPublicQuery ( VdcQueryType.GetConfigurationValue , new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.ProductRPMVersion ) , aQuery ) ; }
Source:
public void prepareParams ( ) { parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( ) ; parameters.setVdsId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; parameters.setStoragePoolId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand < org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase > ( parameters ) ) ; }

Target:
public void prepareParams ( ) { parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( ) ; parameters.setVdsId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; parameters.setStoragePoolId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand < org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase > ( parameters ) ) ; org.mockito.Mockito.doReturn ( storageConnDao ) . when ( command ) . getStorageConnDao ( ) ; }
Source:
public void testZeroLatency ( ) { java.lang.String doubleValue = "0" ; org.ovirt.engine.core.common.businessentities.VmDynamic vmDynamic = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.getVmDynamic ( ) ; java.util.Map < java.lang.String , java.lang.Object > diskData = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.setDiskData ( ) ; diskData.put ( VdsProperties.vm_disk_write_latency , doubleValue ) ; java.util.Map < java.lang.String , java.lang.Object > xml = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.setMockForTesting ( diskData ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectsBuilder.updateVMDynamicData ( vmDynamic , xml ) ; org.junit.Assert.assertEquals ( vmDynamic.getDisks ( ) . get ( 0 ) . getWriteLatency ( ) , new java.lang.Double ( "0" ) ) ; }

Target:
public void testZeroLatency ( ) { java.lang.String doubleValue = "0" ; org.ovirt.engine.core.common.businessentities.VmDynamic vmDynamic = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.getVmDynamic ( ) ; java.util.Map < java.lang.String , java.lang.Object > diskData = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.setDiskData ( ) ; diskData.put ( VdsProperties.vm_disk_write_latency , doubleValue ) ; java.util.Map < java.lang.String , java.lang.Object > xml = org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.setMockForTesting ( diskData ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectsBuilder.updateVMDynamicData ( vmDynamic , xml , org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerObjectBuilderTest.getVds ( ) ) ; org.junit.Assert.assertEquals ( vmDynamic.getDisks ( ) . get ( 0 ) . getWriteLatency ( ) , new java.lang.Double ( "0" ) ) ; }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.VDS > createHosts ( java.lang.Boolean ... isHostUp ) { return java.util.Arrays.stream ( isHostUp ) . map ( ( isUp ) -> isUp ? org.ovirt.engine.core.common.businessentities.VDSStatus.Up : org.ovirt.engine.core.common.businessentities.VDSStatus.Down ) . map ( ( hostStatus ) -> { org.ovirt.engine.core.common.businessentities.VDS host = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; host.setStatus ( hostStatus ) ; return host ; } ) . collect ( java.util.stream.Collectors.toList ( ) ) ; }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.VDS > createHosts ( java.lang.Boolean ... isHostUp ) { return java.util.Arrays.stream ( isHostUp ) . map ( ( isUp ) -> isUp ? org.ovirt.engine.core.common.businessentities.VDSStatus.Up : org.ovirt.engine.core.common.businessentities.VDSStatus.Down ) . map ( ( hostStatus ) -> { org.ovirt.engine.core.common.businessentities.VDS host = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; host.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; host.setStatus ( hostStatus ) ; return host ; } ) . collect ( java.util.stream.Collectors.toList ( ) ) ; }
Source:
public void nonMixedClusterServiceSupported ( ) { mockConfigRule.mockConfigValue ( ConfigValues.AllowClusterWithVirtGlusterEnabled , false ) ; org.mockito.Mockito.when ( cluster.supportsGlusterService ( ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( cluster.supportsVirtService ( ) ) . thenReturn ( false ) ; validator = new org.ovirt.engine.core.bll.validator.ClusterValidator ( dbFacade , cluster ) ; org.junit.Assert.assertThat ( validator.mixedClusterServicesSupported ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void nonMixedClusterServiceSupported ( ) { mockConfigRule.mockConfigValue ( ConfigValues.AllowClusterWithVirtGlusterEnabled , false ) ; org.mockito.Mockito.when ( cluster.supportsGlusterService ( ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( cluster.supportsVirtService ( ) ) . thenReturn ( false ) ; validator = new org.ovirt.engine.core.bll.validator.ClusterValidator ( dbFacade , cluster , cpuFlagsManagerHandler ) ; org.junit.Assert.assertThat ( validator.mixedClusterServicesSupported ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
private void addChildren ( org.ovirt.engine.core.common.businessentities.Tags tag ) { org.ovirt.engine.core.bll.TagsDirector.log.infoFormat ( "Tag {0} added to tree" , tag.gettag_name ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Tags > children = getTagDAO ( ) . getAllForParent ( tag.gettag_id ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.Tags child : children ) { addChildren ( child ) ; org.ovirt.engine.core.bll.TagsDirector.log.infoFormat ( "Tag {0} added as child to parent {1}" , child.gettag_name ( ) , tag.gettag_name ( ) ) ; tag.getChildren ( ) . add ( child ) ; addTagToHash ( tag ) ; addTagToHash ( child ) ; } }

Target:
private void addChildren ( org.ovirt.engine.core.common.businessentities.Tags tag ) { org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added to tree" , tag.gettag_name ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Tags > children = getTagDAO ( ) . getAllForParent ( tag.gettag_id ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.Tags child : children ) { addChildren ( child ) ; org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added as child to parent '{}'" , child.gettag_name ( ) , tag.gettag_name ( ) ) ; tag.getChildren ( ) . add ( child ) ; addTagToHash ( tag ) ; addTagToHash ( child ) ; } }
Source:
public void testMarkHostDevicesUsedByVmId ( ) { dao.markHostDevicesUsedByVmId ( org.ovirt.engine.core.dao.HostDeviceDaoTest.EXISTING_VM_ID ) ; org.ovirt.engine.core.common.businessentities.HostDevice hostDevice = dao.getHostDeviceByHostIdAndDeviceName ( org.ovirt.engine.core.dao.HostDeviceDaoTest.EXISTING_HOST_ID , org.ovirt.engine.core.dao.HostDeviceDaoTest.EXISTING_DEVICE_NAME ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.HostDeviceDaoTest.EXISTING_VM_ID , hostDevice.getVmId ( ) ) ; }

Target:
public void updateNetworkDevice ( ) { org.ovirt.engine.core.common.businessentities.HostDeviceId netDeviceId = new org.ovirt.engine.core.common.businessentities.HostDeviceId ( FixturesTool.NETWORK_HOST_DEVICE_HOST_ID , FixturesTool.NETWORK_HOST_DEVICE_NAME ) ; org.ovirt.engine.core.common.businessentities.HostDevice before = dao.get ( netDeviceId ) ; before.setNetworkInterfaceName ( ( ( before.getNetworkInterfaceName ( ) ) + "new" ) ) ; dao.update ( before ) ; org.ovirt.engine.core.common.businessentities.HostDevice after = dao.get ( netDeviceId ) ; org.junit.Assert.assertNotNull ( after ) ; org.junit.Assert.assertEquals ( before , after ) ; }
Source:
public void testGetRootWithHierarchy ( ) { org.ovirt.engine.core.common.businessentities.tags tag = createTag ( "tag1" , "desc1" ) ; tagsDirector.AddTag ( tag ) ; org.ovirt.engine.core.common.businessentities.tags tags = tagsDirector.GetRootTag ( ) ; org.junit.Assert.assertNotNull ( tags ) ; org.junit.Assert.assertEquals ( tags.gettag_id ( ) , TagsDirector.ROOT_TAG_ID ) ; org.junit.Assert.assertEquals ( 1 , tags.getChildren ( ) . size ( ) ) ; org.junit.Assert.assertEquals ( "tag1" , tags.getChildren ( ) . get ( 0 ) . gettag_name ( ) ) ; }

Target:
public void testGetRootWithHierarchy ( ) { org.ovirt.engine.core.common.businessentities.Tags tag = createTag ( "tag1" , "desc1" ) ; tagsDirector.AddTag ( tag ) ; org.ovirt.engine.core.common.businessentities.Tags tags = tagsDirector.GetRootTag ( ) ; org.junit.Assert.assertNotNull ( tags ) ; org.junit.Assert.assertEquals ( tags.gettag_id ( ) , TagsDirector.ROOT_TAG_ID ) ; org.junit.Assert.assertEquals ( 1 , tags.getChildren ( ) . size ( ) ) ; org.junit.Assert.assertEquals ( "tag1" , tags.getChildren ( ) . get ( 0 ) . gettag_name ( ) ) ; }
Source:
public void testList ( ) throws java.lang.Exception { resource.setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( VdcQueryType.GetVdsHooksById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , getEntity ( 0 ) ) ; org.ovirt.engine.api.model.Hooks hooks = resource.list ( ) ; assertNotNull ( hooks.getHooks ( ) ) ; assertEquals ( 4 , hooks.getHooks ( ) . size ( ) ) ; }

Target:
public void testList ( ) throws java.lang.Exception { resource.setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( QueryType.GetVdsHooksById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , getEntity ( 0 ) ) ; org.ovirt.engine.api.model.Hooks hooks = resource.list ( ) ; assertNotNull ( hooks.getHooks ( ) ) ; assertEquals ( 4 , hooks.getHooks ( ) . size ( ) ) ; }