auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public org.ovirt.engine.sdk.decorators.GroupTag add ( org.ovirt.engine.sdk.decorators.Tag tag ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = ( ( this . parent.getHref ( ) ) + ( SLASH ) ) + ( getName ( ) ) ; java.util.List < org.apache.http.Header > headers = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) . build ( ) ; url = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) . build ( ) ; return getProxy ( ) . add ( url , tag , org.ovirt.engine.sdk.entities.Tag.class , org.ovirt.engine.sdk.decorators.GroupTag.class , headers ) ; }

Target:
public org.ovirt.engine.sdk.decorators.GroupTag add ( org.ovirt.engine.sdk.decorators.Tag tag ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = ( ( this . parent.getHref ( ) ) + ( SLASH ) ) + ( getName ( ) ) ; org.ovirt.engine.sdk.utils.HttpHeaderBuilder headersBuilder = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) ; java.util.List < org.apache.http.Header > headers = headersBuilder.build ( ) ; org.ovirt.engine.sdk.utils.UrlBuilder urlBuilder = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) ; url = urlBuilder.build ( ) ; return getProxy ( ) . add ( url , tag , org.ovirt.engine.sdk.entities.Tag.class , org.ovirt.engine.sdk.decorators.GroupTag.class , headers ) ; }
Source:
public void removeAll ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > interfaces = java.util.Arrays.asList ( createNewInterface ( ) , createNewInterface ( ) ) ; org.mockito.Mockito.when ( vmNetworkInterfaceDAO.getAllForVm ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( interfaces ) ; vmInterfaceManager.removeAll ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface iface : interfaces ) { verifyRemoveAllDelegatedCorrectly ( iface ) ; } }

Target:
public void removeAll ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > interfaces = java.util.Arrays.asList ( createNewInterface ( ) , createNewInterface ( ) ) ; org.mockito.Mockito.when ( vmNetworkInterfaceDAO.getAllForVm ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( interfaces ) ; vmInterfaceManager.removeAll ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface iface : interfaces ) { verifyRemoveAllDelegatedCorrectly ( iface ) ; } }
Source:
public void testListCrash ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; collection.setUriInfo ( uriInfo ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpHooksQueryExpectations ( t ) ; try { getCollection ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.gluster.BACKEND_FAILED_SERVER_LOCALE , t ) ; } }

Target:
public void testListCrash ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; collection.setUriInfo ( uriInfo ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpHooksQueryExpectations ( t ) ; try { getCollection ( ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.gluster.BACKEND_FAILED_SERVER_LOCALE , t ) ; } }
Source:
public static void updateDisksFromDb ( org.ovirt.engine.core.common.businessentities.VM vm ) { java.util.List < org.ovirt.engine.core.common.businessentities.Disk > imageList = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDiskDao ( ) . getAllForVm ( vm.getId ( ) ) ; org.ovirt.engine.core.bll.VmHandler.updateDisksForVm ( vm , imageList ) ; }

Target:
public static void updateDisksFromDb ( org.ovirt.engine.core.common.businessentities.VM vm ) { java.util.List < org.ovirt.engine.core.common.businessentities.Disk > imageList = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDiskDao ( ) . getAllForVm ( vm.getId ( ) ) ; vm.getDiskList ( ) . clear ( ) ; vm.getDiskMap ( ) . clear ( ) ; org.ovirt.engine.core.bll.VmHandler.updateDisksForVm ( vm , imageList ) ; }
Source:
public void validateFailsOnNoConflictServers ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity hook = getHookEntity ( ) ; setUpMocksForAdd ( true , hook ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString ( ) ) ) ; }

Target:
public void validateFailsOnNoConflictServers ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity hook = getHookEntity ( ) ; setUpMocksForAdd ( true , hook ) ; org.junit.jupiter.api.Assertions.assertFalse ( cmd.validate ( ) ) ; org.junit.jupiter.api.Assertions.assertTrue ( cmd.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString ( ) ) ) ; }
Source:
public void testGetNotFound ( ) throws java.lang.Exception { org.ovirt.engine.api.resource.StorageResource subresource = collection.getStorageResource ( "foo" ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpQueryExpectations ( "" ) ; try { subresource.get ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testGetNotFound ( ) throws java.lang.Exception { org.ovirt.engine.api.resource.StorageResource subresource = collection.getStorageResource ( "foo" ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpQueryExpectations ( "" ) ; verifyNotFoundException ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , subresource :: get ) ) ; }
Source:
public boolean serverExists ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo glusterServer ) { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = getVdsGroupDao ( ) . get ( org.ovirt.engine.core.bll.gluster.GetAddedGlusterServersQuery.getParameters ( ) . getClusterId ( ) ) ; if ( org.ovirt.engine.core.common.gluster.GlusterFeatureSupported.glusterHostUuidSupported ( cluster.getcompatibility_version ( ) ) ) { return getDbUtils ( ) . serverExists ( glusterServer.getUuid ( ) ) ; } else { return getDbUtils ( ) . serverExists ( org.ovirt.engine.core.bll.gluster.GetAddedGlusterServersQuery.getParameters ( ) . getClusterId ( ) , glusterServer.getHostnameOrIp ( ) ) ; } }

Target:
public boolean serverExists ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo glusterServer ) { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = getVdsGroupDao ( ) . get ( org.ovirt.engine.core.bll.gluster.GetAddedGlusterServersQuery.getParameters ( ) . getClusterId ( ) ) ; if ( org.ovirt.engine.core.common.gluster.GlusterFeatureSupported.glusterHostUuidSupported ( cluster.getCompatibilityVersion ( ) ) ) { return getDbUtils ( ) . serverExists ( glusterServer.getUuid ( ) ) ; } else { return getDbUtils ( ) . serverExists ( org.ovirt.engine.core.bll.gluster.GetAddedGlusterServersQuery.getParameters ( ) . getClusterId ( ) , glusterServer.getHostnameOrIp ( ) ) ; } }
Source:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel object ) { priorityEditor.setRowData ( new java.util.ArrayList < org.ovirt.engine.ui.uicommonweb.models.EntityModel > ( ) ) ; priorityEditor.edit ( object.getPriority ( ) ) ; org.ovirt.engine.ui.common.widget.uicommon.popup.AbstractVmPopupWidget.Driver.driver.edit ( object ) ; initSliders ( object ) ; initTabAvailabilityListeners ( object ) ; initListeners ( object ) ; initCustomPropertySheet ( object ) ; numOfVmsLabel.setVisible ( false ) ; }

Target:
public void eventRaised ( org.ovirt.engine.core.compat.Event ev , java.lang.Object sender , org.ovirt.engine.core.compat.EventArgs args ) { boolean isAutoAssign = ( ( java.lang.Boolean ) ( object.getIsAutoAssign ( ) . getEntity ( ) ) ) ; defaultHostEditor.setEnabled ( ( ! isAutoAssign ) ) ; specificHost.setValue ( ( ! isAutoAssign ) ) ; }
Source:
public static void getPermittedStorageDomainsByStoragePoolId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId , org.ovirt.engine.core.common.businessentities.ActionGroup actionGroup ) { 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.StorageDomain > ( ) ; } return source ; } } ; org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters params = new org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters ( ) ; params.setStoragePoolId ( dataCenterId ) ; params.setActionGroup ( actionGroup ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetPermittedStorageDomainsByStoragePoolId , params , aQuery ) ; }

Target:
public static void getAllAttachableDisks ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storagePoolId , 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 != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Disk > ( ) ; } } ; org.ovirt.engine.core.common.queries.GetAllAttachableDisks params = new org.ovirt.engine.core.common.queries.GetAllAttachableDisks ( storagePoolId ) ; params.setVmId ( vmId ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllAttachableDisks , params , aQuery ) ; }
Source:
protected org.ovirt.engine.core.searchbackend.ISyntaxChecker getSyntaxChecker ( ) { return org.ovirt.engine.ui.uicommonweb.models.SearchableListModel.syntaxChecker ; }

Target:
protected void startGridTimer ( ) { if ( ( getTimer ( ) ) != null ) { startRefresh ( ) ; } else { com.google.gwt.core.client.Scheduler.get ( ) . scheduleDeferred ( new com.google.gwt.core.client.Scheduler.ScheduledCommand ( ) { @ java.lang.Override public void execute ( ) { startRefresh ( ) ; } } ) ; } }
Source:
protected void syncSearch ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity glusterVolumeEntity = ( ( org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity ) ( getEntity ( ) ) ) ; setItems ( glusterVolumeEntity.getBricks ( ) ) ; }

Target:
protected void onEntityChanged ( ) { super . onEntityChanged ( ) ; if ( ( getEntity ( ) ) != null ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity glusterVolumeEntity = ( ( org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity ) ( getEntity ( ) ) ) ; setItems ( glusterVolumeEntity.getBricks ( ) ) ; } else { setItems ( null ) ; } }
Source:
public boolean equals ( java.lang.Object o ) { if ( ( this ) == o ) { return true ; } if ( ! ( o instanceof org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity ) ) { return false ; } final org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity that = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity ) ( o ) ) ; return java.util.Objects.equals ( externalVnicProfileMapping , that.externalVnicProfileMapping ) ; }

Target:
public boolean equals ( java.lang.Object o ) { if ( ( this ) == o ) { return true ; } if ( ! ( o instanceof org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity ) ) { return false ; } final org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity that = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity ) ( o ) ) ; return isSameSourceProfile ( that ) ; }
Source:
private void assertNetworkAttachment ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment , org.ovirt.engine.core.compat.Guid attachmentId , org.ovirt.engine.core.compat.Guid networkId , org.ovirt.engine.core.compat.Guid nicId ) { org.junit.Assert.assertThat ( "id mismatch" , networkAttachment.getId ( ) , org.hamcrest.CoreMatchers.is ( attachmentId ) ) ; org.junit.Assert.assertThat ( "network id mismatch" , networkAttachment.getNetworkId ( ) , org.hamcrest.CoreMatchers.equalTo ( networkId ) ) ; org.junit.Assert.assertThat ( "nicId mismatch" , networkAttachment.getNicId ( ) , org.hamcrest.CoreMatchers.equalTo ( nicId ) ) ; }

Target:
private void assertNetworkAttachment ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment , org.ovirt.engine.core.compat.Guid attachmentId , org.ovirt.engine.core.compat.Guid networkId , org.ovirt.engine.core.compat.Guid nicId ) { org.hamcrest.MatcherAssert.assertThat ( "id mismatch" , networkAttachment.getId ( ) , org.hamcrest.CoreMatchers.is ( attachmentId ) ) ; org.hamcrest.MatcherAssert.assertThat ( "network id mismatch" , networkAttachment.getNetworkId ( ) , org.hamcrest.CoreMatchers.equalTo ( networkId ) ) ; org.hamcrest.MatcherAssert.assertThat ( "nicId mismatch" , networkAttachment.getNicId ( ) , org.hamcrest.CoreMatchers.equalTo ( nicId ) ) ; }
Source:
public static java.lang.String changeStorageDomainAndPoolInMemoryState ( java.lang.String originalMemoryVolume , org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.compat.Guid storagePoolId ) { java.util.List < org.ovirt.engine.core.compat.Guid > guids = org.ovirt.engine.core.utils.GuidUtils.getGuidListFromString ( originalMemoryVolume ) ; return org.ovirt.engine.core.bll.memory.MemoryUtils.createMemoryStateString ( storageDomainId , storagePoolId , guids.get ( 2 ) , guids.get ( 3 ) , guids.get ( 4 ) , guids.get ( 5 ) ) ; }

Target:
public static java.lang.String changeStorageDomainAndPoolInMemoryState ( java.lang.String originalMemoryVolume , org.ovirt.engine.core.compat.Guid storageDomainId , org.ovirt.engine.core.compat.Guid storagePoolId ) { java.util.List < org.ovirt.engine.core.compat.Guid > guids = org.ovirt.engine.core.compat.Guid.createGuidListFromString ( originalMemoryVolume ) ; return org.ovirt.engine.core.bll.memory.MemoryUtils.createMemoryStateString ( storageDomainId , storagePoolId , guids.get ( 2 ) , guids.get ( 3 ) , guids.get ( 4 ) , guids.get ( 5 ) ) ; }
Source:
public void InternalSetVmStatus ( org.ovirt.engine.core.common.businessentities.VM vm , final org.ovirt.engine.core.common.businessentities.VMStatus status , final org.ovirt.engine.core.common.businessentities.VmExitStatus exitStaus , final java.lang.String exitMessage ) { vm.setStatus ( status ) ; vm.setExitStatus ( exitStaus ) ; vm.setExitMessage ( exitMessage ) ; boolean isVmNotRunning = status.isNotRunning ( ) ; if ( isVmNotRunning || ( status == ( org.ovirt.engine.core.common.businessentities.VMStatus.Unknown ) ) ) { resetVmAttributes ( vm ) ; if ( isVmNotRunning ) { vm.setRunOnVds ( null ) ; vm.setVmPauseStatus ( VmPauseStatus.NONE ) ; } } }

Target:
public void InternalSetVmStatus ( org.ovirt.engine.core.common.businessentities.VM vm , final org.ovirt.engine.core.common.businessentities.VMStatus status , final org.ovirt.engine.core.common.businessentities.VmExitStatus exitStaus , final java.lang.String exitMessage ) { vm.setStatus ( status ) ; vm.setExitStatus ( exitStaus ) ; vm.setExitMessage ( exitMessage ) ; boolean isVmNotRunning = status.isNotRunning ( ) ; if ( isVmNotRunning || ( status == ( org.ovirt.engine.core.common.businessentities.VMStatus.Unknown ) ) ) { resetVmAttributes ( vm ) ; if ( isVmNotRunning ) { vm.setRunOnVds ( null ) ; vm.setVmPauseStatus ( VmPauseStatus.NONE ) ; vm.setLastStopTime ( new java.util.Date ( ) ) ; } } }
Source:
public void edit ( org.ovirt.engine.ui.uicommonweb.models.AbstractErrataCountModel transferObj ) { errataTableView.getErrataTable ( ) . setLoadingState ( LoadingState.LOADING ) ; model.setGuid ( transferObj.getGuid ( ) ) ; errataTableView.init ( model ) ; org.ovirt.engine.core.common.businessentities.HasErrata entity = transferObj.getEntity ( ) ; model.setEntity ( entity ) ; model.search ( ) ; buildErrataDetailPanel ( ) ; setErrataDetailPanelVisibilty ( false ) ; errataTableView.edit ( ) ; }

Target:
public void execute ( ) { errataTableView.onResize ( ) ; }
Source:
public org.ovirt.engine.core.common.action.VdcReturnValueBase RunAction ( org.ovirt.engine.core.common.action.VdcActionType actionType , org.ovirt.engine.core.common.action.VdcActionParametersBase params ) { org.ovirt.engine.ui.frontend.server.gwt.GenericApiGWTServiceImpl.log.debug ( "Server: RunAction invoked!" ) ; params.setSessionId ( getSessionId ( ) ) ; if ( noBackend ) { org.ovirt.engine.core.common.action.VdcReturnValueBase rValue = new org.ovirt.engine.core.common.action.VdcReturnValueBase ( ) ; rValue.setSucceeded ( true ) ; return rValue ; } return getBackend ( ) . RunAction ( actionType , params ) ; }

Target:
public org.ovirt.engine.core.common.action.VdcReturnValueBase RunAction ( org.ovirt.engine.core.common.action.VdcActionType actionType , org.ovirt.engine.core.common.action.VdcActionParametersBase params ) { org.ovirt.engine.ui.frontend.server.gwt.GenericApiGWTServiceImpl.log.debug ( "Server: RunAction invoked!" ) ; debugAction ( actionType , params ) ; params.setSessionId ( getSessionId ( ) ) ; if ( noBackend ) { org.ovirt.engine.core.common.action.VdcReturnValueBase rValue = new org.ovirt.engine.core.common.action.VdcReturnValueBase ( ) ; rValue.setSucceeded ( true ) ; return rValue ; } return getBackend ( ) . RunAction ( actionType , params ) ; }
Source:
private static void checkSeverities ( ) { org.ovirt.engine.core.common.AuditLogType [ ] values = org.ovirt.engine.core.common.AuditLogType.values ( ) ; if ( ( values.length ) != ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.severities.size ( ) ) ) { for ( org.ovirt.engine.core.common.AuditLogType value : values ) { if ( ! ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.severities.containsKey ( value ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warnFormat ( "AuditLogType: {0} not have severity. Assumed Normal" , value.toString ( ) ) ; } } } }

Target:
static org.ovirt.engine.core.common.AuditLogSeverity getSeverityForMessage ( org.ovirt.engine.core.common.AuditLogType messageType ) { org.ovirt.engine.core.common.AuditLogSeverity severity = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.severities.get ( messageType ) ; if ( severity == null ) { severity = org.ovirt.engine.core.common.AuditLogSeverity.NORMAL ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warnFormat ( "AuditLogType: {0} not have severity. Assumed Normal" , messageType.toString ( ) ) ; } return severity ; }
Source:
public void setup ( ) { java.util.Map < java.lang.Integer , java.lang.String > completionMap = new java.util.HashMap < java.lang.Integer , java.lang.String > ( ) ; completionMap.put ( 0 , "other" ) ; completionMap.put ( 1 , "rhel_x" ) ; completionMap.put ( 2 , "rhel_x_y" ) ; completer = new org.ovirt.engine.core.searchbackend.OsValueAutoCompleter ( completionMap ) ; }

Target:
public void setup ( ) { org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap = new java.util.HashMap < java.lang.Integer , java.lang.String > ( ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 0 , "other" ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 1 , "rhel_x" ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 2 , "rhel_x_y" ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 3 , "windows_2008" ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 4 , "windows_2008_R2" ) ; org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap.put ( 5 , "windows_2008_R2x64" ) ; completer = new org.ovirt.engine.core.searchbackend.OsValueAutoCompleter ( org.ovirt.engine.core.searchbackend.OsValueAutoCompleterTest.completionMap ) ; }
Source:
public void getStorageDevices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterStorageDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , aQuery ) ; }

Target:
public void getVmFromOva ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vdsId , java.lang.String path ) { aQuery.setHandleFailure ( true ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmFromOva , new org.ovirt.engine.core.common.queries.GetVmFromOvaQueryParameters ( vdsId , path ) , aQuery ) ; }
Source:
public void testGetRelatedTableName ( ) { org.ovirt.engine.core.searchbackend.SearchObjectAutoCompleter comp = new org.ovirt.engine.core.searchbackend.SearchObjectAutoCompleter ( true ) ; assertEquals ( "EVENTS" , "audit_log" , comp.getRelatedTableName ( "EVENTS" ) ) ; assertNull ( "Garbage" , comp.getRelatedTableName ( "kjfhkjdshkjfs" ) ) ; assertNull ( "Null" , comp.getRelatedTableName ( null ) ) ; }

Target:
public void testGetRelatedTableName ( ) { org.ovirt.engine.core.searchbackend.SearchObjectAutoCompleter comp = new org.ovirt.engine.core.searchbackend.SearchObjectAutoCompleter ( true ) ; org.junit.Assert.assertEquals ( "EVENTS" , "audit_log" , comp.getRelatedTableName ( "EVENTS" ) ) ; org.junit.Assert.assertNull ( "Garbage" , comp.getRelatedTableName ( "kjfhkjdshkjfs" ) ) ; org.junit.Assert.assertNull ( "Null" , comp.getRelatedTableName ( null ) ) ; }
Source:
public org.ovirt.engine.core.common.businessentities.Role get ( org.ovirt.engine.core.compat.Guid id ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "id" , id ) ; return getCallsHandler ( ) . executeRead ( "GetRolsByid" , RolesRowMapper.instance , parameterSource ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.Role > getAllForUserAndGroups ( org.ovirt.engine.core.compat.Guid id , java.lang.String groupIds ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "user_id" , id ) . addValue ( "group_ids" , groupIds ) ; return getCallsHandler ( ) . executeReadList ( "GetAllRolesByUserIdAndGroupIds" , org.ovirt.engine.core.dao.RoleDAODbFacadeImpl.RolesRowMapper.instance , parameterSource ) ; }
Source:
public static void getMaxSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 10 ) ; }

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.RunQuery ( VdcQueryType.Search , searchParams , aQuery ) ; }
Source:
public void testIscsiLunCannotBeAddedIfAddingFloatingDisk ( ) { org.ovirt.engine.core.common.businessentities.storage.LunDisk disk = createISCSILunDisk ( ScsiGenericIO.UNFILTERED , true , DiskInterface.IDE ) ; org.ovirt.engine.core.common.action.AddDiskParameters parameters = org.ovirt.engine.core.bll.AddDiskCommandTest.createParameters ( ) ; parameters.setDiskInfo ( disk ) ; initializeCommand ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , parameters ) ; org.junit.Assert.assertFalse ( "Floating disk with SCSI reservation set successfully added" , command.checkIfLunDiskCanBeAdded ( spyDiskValidator ( disk ) ) ) ; verifyCanDoActionMessagesContainMessage ( VdcBllMessages.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK ) ; }

Target:
public void testIscsiLunCannotBeAddedIfAddingFloatingDisk ( ) { org.ovirt.engine.core.common.businessentities.storage.LunDisk disk = createISCSILunDisk ( ScsiGenericIO.UNFILTERED , true , DiskInterface.IDE ) ; org.ovirt.engine.core.common.action.AddDiskParameters parameters = org.ovirt.engine.core.bll.AddDiskCommandTest.createParameters ( ) ; parameters.setDiskInfo ( disk ) ; initializeCommand ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , parameters ) ; org.junit.Assert.assertFalse ( "Floating disk with SCSI reservation set successfully added" , command.checkIfLunDiskCanBeAdded ( spyDiskValidator ( disk ) ) ) ; verifyCanDoActionMessagesContainMessage ( EngineMessage.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK ) ; }
Source:
protected boolean isImageNotLocked ( ) { org.ovirt.engine.core.common.businessentities.DiskImage diskImage = org.ovirt.engine.core.bll.MoveOrCopyDiskCommand.getImage ( ) ; if ( ( diskImage.getImageStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.ImageStatus.LOCKED ) ) { if ( ( org.ovirt.engine.core.bll.MoveOrCopyDiskCommand.getParameters ( ) . getOperation ( ) ) == ( org.ovirt.engine.core.common.businessentities.ImageOperation.Move ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED , java.lang.String.format ( "$%1$s %2$s" , "diskAliases" , diskImage.getDiskAlias ( ) ) ) ; } else { return failCanDoAction ( VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED ) ; } } return true ; }

Target:
protected boolean isImageNotLocked ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage = org.ovirt.engine.core.bll.MoveOrCopyDiskCommand.getImage ( ) ; if ( ( diskImage.getImageStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.ImageStatus.LOCKED ) ) { if ( ( org.ovirt.engine.core.bll.MoveOrCopyDiskCommand.getParameters ( ) . getOperation ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.ImageOperation.Move ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED , java.lang.String.format ( "$%1$s %2$s" , "diskAliases" , diskImage.getDiskAlias ( ) ) ) ; } else { return failCanDoAction ( VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED ) ; } } return true ; }
Source:
public void canDoActionSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommandTest.CLUSTER_ID , org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommandTest.HOOK_ID ) ) ) ; setupMocks ( ) ; org.junit.Assert.assertTrue ( cmd.canDoAction ( ) ) ; }

Target:
public void canDoActionFailsOnNullCluster ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( null , HOOK_ID ) ) ) ; setupMocks ( cmd ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID.toString ( ) ) ) ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs changedArgs = ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) ; if ( "IsDiskHotPlugAvailable" . equals ( changedArgs.propertyName ) ) { com.google.gwt.event.logical.shared.InitializeEvent.fire ( plugButtonDefinition ) ; com.google.gwt.event.logical.shared.InitializeEvent.fire ( unPlugButtonDefinition ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { if ( "IsDiskHotPlugAvailable" . equals ( args.propertyName ) ) { com.google.gwt.event.logical.shared.InitializeEvent.fire ( plugButtonDefinition ) ; com.google.gwt.event.logical.shared.InitializeEvent.fire ( unPlugButtonDefinition ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.vm_pools mockVMPoolsFromDAO ( org.ovirt.engine.core.compat.Guid requestedUser ) { org.ovirt.engine.core.common.businessentities.vm_pools expectedPool = new org.ovirt.engine.core.common.businessentities.vm_pools ( ) ; org.ovirt.engine.core.dao.VmPoolDAO vmDaoPoolMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmPoolDAO.class ) ; org.mockito.Mockito.when ( vmDaoPoolMock.getAllForUser ( requestedUser ) ) . thenReturn ( java.util.Collections.singletonList ( expectedPool ) ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmPoolDAO ( ) ) . thenReturn ( vmDaoPoolMock ) ; return expectedPool ; }

Target:
private org.ovirt.engine.core.common.businessentities.vm_pools mockVMPoolsFromDAO ( org.ovirt.engine.core.compat.Guid requestedUser ) { org.ovirt.engine.core.common.businessentities.vm_pools expectedPool = new org.ovirt.engine.core.common.businessentities.vm_pools ( ) ; org.ovirt.engine.core.dao.VmPoolDAO vmDaoPoolMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmPoolDAO.class ) ; org.mockito.Mockito.when ( vmDaoPoolMock.getAllForUser ( requestedUser ) ) . thenReturn ( java.util.Collections.singletonList ( expectedPool ) ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmPoolDao ( ) ) . thenReturn ( vmDaoPoolMock ) ; return expectedPool ; }
Source:
protected void analyze ( ) { proceedDownVms ( ) ; proceedWatchdogEvents ( ) ; proceedBalloonCheck ( ) ; proceedGuaranteedMemoryCheck ( ) ; updateRepository ( ) ; prepareGuestAgentNetworkDevicesForUpdate ( ) ; updateLunDisks ( ) ; updateVmJobs ( ) ; analyzeExternalVms ( ) ; analyzeHostedEngineVm ( ) ; }

Target:
protected void analyze ( ) { if ( ( vdsmVm ) == null ) { removeVmFromCache ( ) ; return ; } proceedDownVms ( ) ; proceedWatchdogEvents ( ) ; proceedBalloonCheck ( ) ; proceedGuaranteedMemoryCheck ( ) ; updateRepository ( ) ; prepareGuestAgentNetworkDevicesForUpdate ( ) ; updateLunDisks ( ) ; updateVmJobs ( ) ; analyzeExternalVms ( ) ; analyzeHostedEngineVm ( ) ; }
Source:
private static boolean isHostStatusOff ( org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue ) { java.lang.String OFF = "off" ; boolean result = false ; if ( ( returnValue != null ) && ( ( returnValue.getReturnValue ( ) ) != null ) ) { org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue value = ( ( org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue ) ( returnValue.getReturnValue ( ) ) ) ; result = value.getStatus ( ) . equalsIgnoreCase ( OFF ) ; } return result ; }

Target:
private static boolean isHostStatusOff ( org.ovirt.engine.core.common.vdscommands.VDSFenceReturnValue returnValue ) { java.lang.String OFF = "off" ; boolean result = false ; if ( returnValue != null ) { org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue value = ( ( org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue ) ( returnValue.getReturnValue ( ) ) ) ; result = value.getStatus ( ) . equalsIgnoreCase ( OFF ) ; } return result ; }
Source:
private org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.network.Network > getNetworkBusinessEntityMap ( ) { if ( ( networkBusinessEntityMap ) == null ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks = org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand.getNetworkDao ( ) . getAllForCluster ( org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand.getVdsGroupId ( ) ) ; networkBusinessEntityMap = new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( networks ) ; } return networkBusinessEntityMap ; }

Target:
private java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > getLabelToNic ( java.util.Collection < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > nics ) { java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > labelToNic = new java.util.HashMap < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic : nics ) { if ( ( nic.getLabels ( ) ) != null ) { for ( java.lang.String label : nic.getLabels ( ) ) { labelToNic.put ( label , nic ) ; } } } return labelToNic ; }
Source:
public void testRemoveActionVersionMap ( ) { org.ovirt.engine.core.common.businessentities.ActionVersionMap dummy = new org.ovirt.engine.core.common.businessentities.ActionVersionMap ( ) ; dummy.setaction_type ( VdcActionType.RebootVm ) ; dummy.setcluster_minimal_version ( "3.0" ) ; dummy.setstorage_pool_minimal_version ( "3.0" ) ; dao.addActionVersionMap ( dummy ) ; org.ovirt.engine.core.common.businessentities.ActionVersionMap result = dao.getActionVersionMapByActionType ( dummy.getaction_type ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; dao.removeActionVersionMap ( dummy.getaction_type ( ) ) ; result = dao.getActionVersionMapByActionType ( dummy.getaction_type ( ) ) ; org.junit.Assert.assertNull ( result ) ; }

Target:
public void testRemoveActionVersionMap ( ) { org.ovirt.engine.core.common.businessentities.ActionVersionMap dummy = new org.ovirt.engine.core.common.businessentities.ActionVersionMap ( ) ; dummy.setActionType ( VdcActionType.RebootVm ) ; dummy.setClusterMinimalVersion ( "3.0" ) ; dummy.setStoragePoolMinimalVersion ( "3.0" ) ; dao.addActionVersionMap ( dummy ) ; org.ovirt.engine.core.common.businessentities.ActionVersionMap result = dao.getActionVersionMapByActionType ( dummy.getActionType ( ) ) ; org.junit.Assert.assertNotNull ( result ) ; dao.removeActionVersionMap ( dummy.getActionType ( ) ) ; result = dao.getActionVersionMapByActionType ( dummy.getActionType ( ) ) ; org.junit.Assert.assertNull ( result ) ; }
Source:
public static void GetClusterGlusterServices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters parameters = new org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters ( clusterId , "" , "" , false ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetGlusterVolumeAdvancedDetails , parameters , aQuery ) ; }

Target:
public static void GetHostFingerprint ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String hostAddress ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetServerSSHKeyFingerprint , new org.ovirt.engine.core.common.queries.ServerParameters ( hostAddress ) , aQuery ) ; }
Source:
public void testNetworkIpAddressWasSameAsHostnameAndChangedWhenIfaceDoesNotExist ( ) { org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment = createNetworkAttachmentWithIpConfiguration ( NetworkBootProtocol.STATIC_IP , null , null ) ; attachment.setNicName ( "nicName" ) ; org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator validator = createNetworkAttachmentValidator ( attachment ) ; org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > nics = new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > emptyList ( ) ) ; org.junit.Assert.assertThat ( validator.networkIpAddressWasSameAsHostnameAndChanged ( nics ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void testNetworkIpAddressWasSameAsHostnameAndChangedWhenIpConfigurationIsDhcp ( ) { doTestNetworkIpAddressWasSameAsHostnameAndChangedForBootProtocol ( Ipv4BootProtocol.DHCP ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > getClustersWithPermittedAction ( org.ovirt.engine.core.compat.Guid userId , org.ovirt.engine.core.common.businessentities.ActionGroup actionGroup ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "user_id" , userId ) . addValue ( "action_group_id" , actionGroup.getId ( ) ) ; return getCallsHandler ( ) . executeReadList ( "fn_perms_get_vds_groups_with_permitted_action" , org.ovirt.engine.core.dao.VdsGroupDaoImpl.VdsGroupRowMapper.instance , parameterSource ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.Cluster > getClustersWithPermittedAction ( org.ovirt.engine.core.compat.Guid userId , org.ovirt.engine.core.common.businessentities.ActionGroup actionGroup ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "user_id" , userId ) . addValue ( "action_group_id" , actionGroup.getId ( ) ) ; return getCallsHandler ( ) . executeReadList ( "fn_perms_get_clusters_with_permitted_action" , org.ovirt.engine.core.dao.ClusterDaoImpl.ClusterRowMapper.instance , parameterSource ) ; }
Source:
private void mockGetVmsListForDisk ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VM > ( ) ; org.ovirt.engine.core.common.businessentities.VM vm1 = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm1.setStatus ( VMStatus.PoweredDown ) ; org.ovirt.engine.core.common.businessentities.VM vm2 = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm2.setStatus ( VMStatus.Down ) ; vmList.add ( vm1 ) ; vmList.add ( vm2 ) ; org.mockito.Mockito.when ( vmDao.getVmsListForDisk ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vmList ) ; }

Target:
private void mockGetVmsListForDisk ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VM > ( ) ; org.ovirt.engine.core.common.businessentities.VM vm1 = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm1.setStatus ( VMStatus.PoweringDown ) ; org.ovirt.engine.core.common.businessentities.VM vm2 = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm2.setStatus ( VMStatus.Down ) ; vmList.add ( vm1 ) ; vmList.add ( vm2 ) ; org.mockito.Mockito.when ( vmDao.getVmsListForDisk ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vmList ) ; }
Source:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( VdcQueryType.GetVmInterfacesByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.AbstractBackendNicsResourceTest.PARENT_ID } , new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ( ) ) ; control.replay ( ) ; try { resource.update ( getNic ( false ) ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( VdcQueryType.GetVmInterfacesByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmNicResourceTest.VM_ID } , new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ( ) ) ; control.replay ( ) ; try { resource.update ( getNic ( false ) ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void testListIncludeStatistics ( ) throws java.lang.Exception { try { accepts.add ( "application/xml; detail=statistics" ) ; setUriInfo ( setUpUriExpectations ( null ) ) ; setUpQueryExpectations ( "" ) ; java.util.List < org.ovirt.engine.api.model.Disk > disks = getCollection ( ) ; assertTrue ( disks.get ( 0 ) . isSetStatistics ( ) ) ; verifyCollection ( disks ) ; } finally { accepts.clear ( ) ; } }

Target:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { setUpEntityQueryExpectations ( 1 , failure ) ; control.replay ( ) ; }
Source:
public void testAddUser_3 ( ) throws java.lang.Exception { setUpAddUserExpectations ( ( ( ( "ADUSER@" + ( DOMAIN ) ) + ":: username=" ) + ( NAMES [ 0 ] ) ) ) ; org.ovirt.engine.api.model.User model = new org.ovirt.engine.api.model.User ( ) ; model.setUserName ( ( ( ( NAMES [ 0 ] ) + "@" ) + ( DOMAIN ) ) ) ; javax.ws.rs.core.Response response = collection.add ( model ) ; verifyAddUser ( response ) ; }

Target:
public void testAddUser_3 ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetDomainList , org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , setUpDomains ( ) ) ; setUpAddUserExpectations ( ( ( ( "ADUSER@" + ( DOMAIN ) ) + ":: username=" ) + ( NAMES [ 0 ] ) ) ) ; org.ovirt.engine.api.model.User model = new org.ovirt.engine.api.model.User ( ) ; model.setUserName ( ( ( ( NAMES [ 0 ] ) + "@" ) + ( DOMAIN ) ) ) ; javax.ws.rs.core.Response response = collection.add ( model ) ; verifyAddUser ( response ) ; }
Source:
public static void GetDiskMaxSize ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxBlockDiskSize , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }

Target:
public static void GetDefaultSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; aQuery.asyncCallback.OnSuccess ( aQuery.getModel ( ) , 5 ) ; }
Source:
public void vnicCreated ( org.ovirt.engine.core.compat.Guid vmId ) { getWindow ( ) . stopProgress ( ) ; cancel ( ) ; setGuideContext ( vmId ) ; updateActionAvailability ( ) ; getGuideCommand ( ) . execute ( ) ; }

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 ) ; setGuideContext ( returnValue.getActionReturnValue ( ) ) ; updateActionAvailability ( ) ; getGuideCommand ( ) . execute ( ) ; } else { cancel ( ) ; } super . executed ( result ) ; }
Source:
private void mockDAOForQuery ( ) { org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getQuotaDAO ( ) ) . thenReturn ( quotaDAO ) ; returnedQuotas = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Quota > ( ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getAdElementId ( ) ) . thenReturn ( adElementId ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getStoragePoolId ( ) ) . thenReturn ( storagePoolId ) ; org.mockito.Mockito.when ( quotaDAO.getQuotaByAdElementId ( adElementId , storagePoolId ) ) . thenReturn ( returnedQuotas ) ; }

Target:
private void mockDAOForQuery ( ) { org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getQuotaDao ( ) ) . thenReturn ( quotaDAO ) ; returnedQuotas = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Quota > ( ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getAdElementId ( ) ) . thenReturn ( adElementId ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getStoragePoolId ( ) ) . thenReturn ( storagePoolId ) ; org.mockito.Mockito.when ( quotaDAO.getQuotaByAdElementId ( adElementId , storagePoolId ) ) . thenReturn ( returnedQuotas ) ; }
Source:
public boolean getShouldPoll ( ) { org.ovirt.engine.core.bll.AsyncTaskState state = getState ( ) ; return ( ( ( ( state == ( AsyncTaskState.Polling ) ) || ( state == ( AsyncTaskState.Ended ) ) ) || ( state == ( AsyncTaskState.ClearFailed ) ) ) && ( ( getLastTaskStatus ( ) . getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.unknown ) ) ) && ( ( getParameters ( ) . getEntityId ( ) ) == null ? isTaskOverPrePollingLapse ( ) : true ) ; }

Target:
public boolean getShouldPoll ( ) { org.ovirt.engine.core.bll.AsyncTaskState state = getState ( ) ; return ( ( ( ( state == ( AsyncTaskState.Polling ) ) || ( state == ( AsyncTaskState.Ended ) ) ) || ( state == ( AsyncTaskState.ClearFailed ) ) ) && ( ( getLastTaskStatus ( ) . getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.unknown ) ) ) && ( ( getParameters ( ) . getEntityInfo ( ) ) == null ? isTaskOverPrePollingLapse ( ) : true ) ; }