auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity getVolume ( int brickCount , boolean withDuplicateBricks ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volumeEntity = new org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity ( ) ; volumeEntity.setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; volumeEntity.setClusterId ( clusterId ) ; volumeEntity.setName ( "vol1" ) ; volumeEntity.setVolumeType ( GlusterVolumeType.DISTRIBUTE ) ; volumeEntity.setBricks ( getBricks ( volumeEntity.getId ( ) , brickCount , withDuplicateBricks ) ) ; return volumeEntity ; }

Target:
private org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity getVolume ( int brickCount , boolean withDuplicateBricks ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity volumeEntity = new org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity ( ) ; volumeEntity.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; volumeEntity.setClusterId ( clusterId ) ; volumeEntity.setName ( "vol1" ) ; volumeEntity.setVolumeType ( GlusterVolumeType.DISTRIBUTE ) ; volumeEntity.setBricks ( getBricks ( volumeEntity.getId ( ) , brickCount , withDuplicateBricks ) ) ; return volumeEntity ; }
Source:
private java.lang.String getVmIsBeingImportedMessage ( ) { java.lang.StringBuilder builder = new java.lang.StringBuilder ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED.name ( ) ) ; if ( ( org.ovirt.engine.core.bll.ImportVmCommand.getVmName ( ) ) != null ) { builder.append ( java.lang.String.format ( "$VmName %1$s" , org.ovirt.engine.core.bll.ImportVmCommand.getVmName ( ) ) ) ; } return builder.toString ( ) ; }

Target:
private boolean isBalloonDeviceExists ( java.util.Collection < org.ovirt.engine.core.common.businessentities.VmDevice > devices ) { for ( org.ovirt.engine.core.common.businessentities.VmDevice vmDevice : getVm ( ) . getManagedVmDeviceMap ( ) . values ( ) ) { if ( org.ovirt.engine.core.common.utils.VmDeviceCommonUtils.isMemoryBalloon ( vmDevice ) ) { return true ; } } return false ; }
Source:
public void createCommand ( ) { org.ovirt.engine.core.common.action.RunVmParams param = new org.ovirt.engine.core.common.action.RunVmParams ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.RunVmCommand < org.ovirt.engine.core.common.action.RunVmParams > ( param ) ) ; mockVmRunHandler ( ) ; mockSuccessfulSnapshotValidator ( ) ; mockVmPropertiesUtils ( ) ; mockBackend ( ) ; }

Target:
private void mockIsoDomainListSyncronizer ( ) { org.mockito.Mockito.doNothing ( ) . when ( isoDomainListSyncronizer ) . init ( ) ; org.mockito.Mockito.doReturn ( isoDomainListSyncronizer ) . when ( command ) . getIsoDomainListSyncronizer ( ) ; }
Source:
protected void configure ( ) { bind ( org.ovirt.engine.ui.uicommonweb.ConsoleOptionsFrontendPersister.class ) . to ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.class ) . in ( com.google.inject.Singleton.class ) ; bind ( org.ovirt.engine.ui.uicommonweb.ConsoleUtils.class ) . to ( org.ovirt.engine.ui.common.utils.ConsoleUtilsImpl.class ) . in ( com.google.inject.Singleton.class ) ; }

Target:
protected void configure ( ) { bind ( org.ovirt.engine.ui.uicommonweb.ConsoleOptionsFrontendPersister.class ) . to ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.class ) . in ( com.google.inject.Singleton.class ) ; bind ( org.ovirt.engine.ui.uicommonweb.ConsoleUtils.class ) . to ( org.ovirt.engine.ui.common.utils.ConsoleUtilsImpl.class ) . in ( com.google.inject.Singleton.class ) ; bind ( org.ovirt.engine.ui.common.presenter.PluginActionButtonHandler.class ) . in ( com.google.inject.Singleton.class ) ; }
Source:
public void testAddVersionNoBaseTemplateId ( ) { setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Template t = org.ovirt.engine.api.restapi.resource.BackendTemplatesResourceTest.getModel ( 2 ) ; t.getVersion ( ) . setBaseTemplate ( null ) ; try { collection.add ( t ) ; org.junit.jupiter.api.Assertions.fail ( "Should have failed with 400 error due to a missing base template" ) ; } catch ( javax.ws.rs.WebApplicationException e ) { org.junit.jupiter.api.Assertions.assertNotNull ( e.getResponse ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( 400 , e.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testAddVersionNoBaseTemplateId ( ) { setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Template t = org.ovirt.engine.api.restapi.resource.BackendTemplatesResourceTest.getModel ( 2 ) ; t.getVersion ( ) . setBaseTemplate ( null ) ; try { collection.add ( t ) ; org.junit.jupiter.api.Assertions.fail ( "Should have failed with 400 error due to a missing base template" ) ; } catch ( javax.ws.rs.WebApplicationException e ) { verifyBadRequest ( e ) ; } }
Source:
public void getClusterFeaturesByVersionAndCategory ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Version version , org.ovirt.engine.core.common.mode.ApplicationMode category ) { 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.Set < org.ovirt.engine.core.common.businessentities.AdditionalFeature > ) ( source ) ) : new java.util.HashSet < org.ovirt.engine.core.common.businessentities.AdditionalFeature > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClusterFeaturesByVersionAndCategory , new org.ovirt.engine.core.common.queries.GetClusterFeaturesByVersionAndCategoryParameters ( version , category ) , aQuery ) ; }

Target:
public void getClusterFeaturesByVersionAndCategory ( org.ovirt.engine.ui.frontend.AsyncQuery < java.util.Set < org.ovirt.engine.core.common.businessentities.AdditionalFeature > > aQuery , org.ovirt.engine.core.compat.Version version , org.ovirt.engine.core.common.mode.ApplicationMode category ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.SetConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClusterFeaturesByVersionAndCategory , new org.ovirt.engine.core.common.queries.GetClusterFeaturesByVersionAndCategoryParameters ( version , category ) , aQuery ) ; }
Source:
private static void addBootProtocol ( java.util.Map < java.lang.String , java.lang.Object > entry , org.ovirt.engine.core.common.businessentities.VDS host , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface ) { org.ovirt.engine.core.vdsbroker.vdsbroker.BootProtocolResolver resolver = ( org.ovirt.engine.core.common.FeatureSupported.cfgEntriesDeprecated ( host.getClusterCompatibilityVersion ( ) ) ) ? new org.ovirt.engine.core.vdsbroker.vdsbroker.NoCfgBootProtocolResolver ( entry , iface ) : new org.ovirt.engine.core.vdsbroker.vdsbroker.CfgBootProtocolResolver ( entry , iface ) ; resolver.resolve ( ) ; }

Target:
private static java.lang.String getIpv6Address ( java.util.Map < java.lang.String , java.lang.Object > properties ) { final java.lang.Object [ ] ipv6Addresses = ( ( java.lang.Object [ ] ) ( properties.get ( "ipv6addrs" ) ) ) ; if ( ( ipv6Addresses == null ) || ( ( ipv6Addresses.length ) == 0 ) ) { return null ; } return ( ( java.lang.String ) ( ipv6Addresses [ 0 ] ) ) ; }
Source:
public void testGetEntityNameByIdAndTypeForVmInterface ( ) { org.ovirt.engine.core.common.businessentities.VmNetworkInterface vmInterface = dbFacade.getVmNetworkInterfaceDAO ( ) . get ( org.ovirt.engine.core.dao.DbFacadeDAOTest.VM_INTERFACE_ID ) ; org.junit.Assert.assertNotNull ( vmInterface ) ; java.lang.String name = vmInterface.getName ( ) ; org.junit.Assert.assertTrue ( name.equals ( dbFacade.getEntityNameByIdAndType ( org.ovirt.engine.core.dao.DbFacadeDAOTest.VM_INTERFACE_ID , VdcObjectType.VmInterface ) ) ) ; }

Target:
public void testGetEntityNameByIdAndTypeForVmInterface ( ) { org.ovirt.engine.core.common.businessentities.VmNetworkInterface vmInterface = dbFacade.getVmNetworkInterfaceDao ( ) . get ( org.ovirt.engine.core.dao.DbFacadeDAOTest.VM_INTERFACE_ID ) ; org.junit.Assert.assertNotNull ( vmInterface ) ; java.lang.String name = vmInterface.getName ( ) ; org.junit.Assert.assertTrue ( name.equals ( dbFacade.getEntityNameByIdAndType ( org.ovirt.engine.core.dao.DbFacadeDAOTest.VM_INTERFACE_ID , VdcObjectType.VmInterface ) ) ) ; }
Source:
public void getDataCenterById ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStoragePoolById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) . withoutRefresh ( ) , aQuery ) ; }

Target:
public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source != null ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Label > list = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Label > ) ( source ) ) ; java.util.Collections.sort ( list , new org.ovirt.engine.core.common.businessentities.comparators.NameableComparator ( ) ) ; return list ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Label > ( ) ; }
Source:
public void getStorageConnectionById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String id , boolean isRefresh ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( source ) ) : null ; } } ; org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase params = new org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase ( id ) ; params.setRefresh ( isRefresh ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageServerConnectionById , params , aQuery ) ; }

Target:
public void getExistingStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.common.businessentities.StorageDomainType domainType , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType , java.lang.String path ) { 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 ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( hostId , storageType , domainType , path ) , aQuery ) ; }
Source:
private void checkStoragePoolFails ( ) { org.mockito.Mockito.when ( facade.getStoragePoolDao ( ) . get ( storagePool.getId ( ) ) ) . thenReturn ( null ) ; org.junit.Assert.assertFalse ( cmd.checkStoragePool ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST.toString ( ) ) ) ; }

Target:
private void checkStoragePoolFails ( ) { org.mockito.Mockito.when ( facade.getStoragePoolDao ( ) . get ( storagePool.getId ( ) ) ) . thenReturn ( null ) ; org.junit.Assert.assertFalse ( cmd.checkStoragePool ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST.toString ( ) ) ) ; }
Source:
public void onTimer ( ) { try { org.ovirt.engine.core.bll.AuditLogCleanupManager.log.info ( "Start deleteAgedOutAuditLogs" ) ; org.ovirt.engine.core.compat.DateTime latestTimeToKeep = org.ovirt.engine.core.compat.DateTime.getNow ( ) . AddDays ( ( ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.AuditLogAgingThreshold ) ) * ( - 1 ) ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAuditLogDao ( ) . removeAllBeforeDate ( latestTimeToKeep ) ; org.ovirt.engine.core.bll.AuditLogCleanupManager.log.info ( "Finished deleteAgedOutAuditLogs" ) ; } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.bll.AuditLogCleanupManager.log.error ( "deleteAgedOutAuditLog failed with exception" , e ) ; } }

Target:
public void onTimer ( ) { try { org.ovirt.engine.core.bll.AuditLogCleanupManager.log.info ( "Start deleteAgedOutAuditLogs" ) ; org.ovirt.engine.core.compat.DateTime latestTimeToKeep = org.ovirt.engine.core.compat.DateTime.getNow ( ) . addDays ( ( ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.AuditLogAgingThreshold ) ) * ( - 1 ) ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAuditLogDao ( ) . removeAllBeforeDate ( latestTimeToKeep ) ; org.ovirt.engine.core.bll.AuditLogCleanupManager.log.info ( "Finished deleteAgedOutAuditLogs" ) ; } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.bll.AuditLogCleanupManager.log.error ( "deleteAgedOutAuditLog failed with exception" , e ) ; } }
Source:
protected void init ( ) { super . init ( ) ; initResource ( resource.getCollection ( ) ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setAllContentHeaderExpectation ( ) ; setUpEntityQueryExpectations ( 1 ) ; setGetGuestAgentQueryExpectations ( 1 ) ; control.replay ( ) ; org.ovirt.engine.api.model.Nic nic = resource.get ( ) ; verifyModelSpecific ( nic , 1 ) ; verifyLinks ( nic ) ; }
Source:
public void testCanDoActionWithEmptySnapshotGuid ( ) { org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters params = new org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters ( vmId , org.ovirt.engine.core.compat.Guid.Empty ) ; cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand ( params ) ) ; org.mockito.Mockito.doNothing ( ) . when ( cmd ) . updateVmDisksFromDb ( ) ; org.mockito.Mockito.doReturn ( snapshotDao ) . when ( cmd ) . getSnapshotDao ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID ) ; }

Target:
public void testValidateWithEmptySnapshotGuid ( ) { org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters params = new org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters ( vmId , org.ovirt.engine.core.compat.Guid.Empty ) ; cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand ( params ) ) ; org.mockito.Mockito.doNothing ( ) . when ( cmd ) . updateVmDisksFromDb ( ) ; org.mockito.Mockito.doReturn ( snapshotDao ) . when ( cmd ) . getSnapshotDao ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID ) ; }
Source:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { performLogin ( loginModel ) ; } } ) ; }

Target:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { super . onLogin ( loginModel ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { commonModelProvider.get ( ) . updateReportsAvailability ( ) ; } } ) ; performLogin ( loginModel ) ; }
Source:
private void initializeOsRepository ( org.ovirt.engine.core.common.businessentities.storage.DiskInterface diskInterface ) { java.util.ArrayList < java.lang.String > supportedDiskInterfaces = new java.util.ArrayList < > ( ) ; supportedDiskInterfaces.add ( diskInterface.name ( ) ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.ovirt.engine.core.bll.validator.storage.DiskVmElementValidatorTest.OS_WITH_SUPPORTED_INTERFACES , null ) ) . thenReturn ( supportedDiskInterfaces ) ; org.ovirt.engine.core.common.utils.SimpleDependencyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; }

Target:
private void initializeInterfaceValidation ( org.ovirt.engine.core.common.businessentities.storage.DiskInterface diskInterface ) { org.mockito.Mockito.when ( vmValidationUtils.isDiskInterfaceSupportedByOs ( org.ovirt.engine.core.bll.validator.storage.DiskVmElementValidatorTest.OS_WITH_SUPPORTED_INTERFACES , null , diskInterface ) ) . thenReturn ( true ) ; injectorRule.bind ( org.ovirt.engine.core.bll.validator.VmValidationUtils.class , vmValidationUtils ) ; }
Source:
public void testGetAllWithFailbackByVds ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > result = dao.getAllWithFailbackByVds ( org.ovirt.engine.core.dao.VmStaticDAOTest.VDS_STATIC_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VmStatic vm : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.VmStaticDAOTest.VDS_GROUP_ID , vm.getvds_group_id ( ) ) ; } }

Target:
public void testGetAllWithFailbackByVds ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > result = dao.getAllWithFailbackByVds ( org.ovirt.engine.core.dao.VmStaticDAOTest.VDS_STATIC_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VmStatic vm : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.VmStaticDAOTest.VDS_GROUP_ID , vm.getVdsGroupId ( ) ) ; } }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getDismissCommand ( ) ) ) { dismissAlert ( ) ; } else if ( command == ( getClearAllCommand ( ) ) ) { clearAllDismissedAlerts ( ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getDismissCommand ( ) ) ) { dismissAlert ( ) ; } else if ( command == ( getDisplayAllCommand ( ) ) ) { displayAllAlerts ( ) ; } else if ( command == ( getClearAllCommand ( ) ) ) { clearAllAlerts ( ) ; } }
Source:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic updateDiskImageDynamicIntoDB ( org.ovirt.engine.core.common.businessentities.storage.DiskImage image ) { org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic diskDynamic = new org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic ( ) ; diskDynamic.setId ( image.getImageId ( ) ) ; diskDynamic.setactual_size ( image.getActualSizeInBytes ( ) ) ; getDiskImageDynamicDAO ( ) . save ( diskDynamic ) ; return diskDynamic ; }

Target:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic updateDiskImageDynamicIntoDB ( org.ovirt.engine.core.common.businessentities.storage.DiskImage image ) { org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic diskDynamic = new org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic ( ) ; diskDynamic.setId ( image.getImageId ( ) ) ; diskDynamic.setactual_size ( image.getActualSizeInBytes ( ) ) ; getDiskImageDynamicDao ( ) . save ( diskDynamic ) ; return diskDynamic ; }
Source:
public org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeGeoRepStatusForXmlRpc glusterVolumeGeoRepStatus ( ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "GlusterVolume.geoRepStatus" ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withIgnoreResponseKey ( ) ; return new org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeGeoRepStatusForXmlRpc ( response ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterVolumeGeoRepSessionResume ( java.lang.String volumeName , java.lang.String slaveHostName , java.lang.String slaveVolumeName , boolean force ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "GlusterVolume.geoRepSessionResume" ) . withParameter ( "volumeName" , volumeName ) . withParameter ( "remoteHost" , slaveHostName ) . withParameter ( "remoteVolumeName" , slaveVolumeName ) . withParameter ( "force" , force ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( response ) ; }
Source:
protected boolean checkNumberOfMonitors ( ) { java.util.Collection < org.ovirt.engine.core.common.businessentities.GraphicsType > graphicsTypes = org.ovirt.engine.core.bll.VmHandler.getResultingVmGraphics ( org.ovirt.engine.core.bll.utils.VmDeviceUtils.getGraphicsTypesOfEntity ( org.ovirt.engine.core.bll.AddVmCommand.getVmTemplateId ( ) ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getGraphicsDevices ( ) ) ; int numOfMonitors = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getNumOfMonitors ( ) ; return org.ovirt.engine.core.bll.VmHandler.isNumOfMonitorsLegal ( graphicsTypes , numOfMonitors , org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getValidationMessages ( ) ) ; }

Target:
protected boolean checkNumberOfMonitors ( ) { java.util.Collection < org.ovirt.engine.core.common.businessentities.GraphicsType > graphicsTypes = org.ovirt.engine.core.bll.VmHandler.getResultingVmGraphics ( org.ovirt.engine.core.bll.utils.VmDeviceUtils.getGraphicsTypesOfEntity ( org.ovirt.engine.core.bll.AddVmCommand.getVmTemplateId ( ) ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getGraphicsDevices ( ) ) ; int numOfMonitors = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getNumOfMonitors ( ) ; return org.ovirt.engine.core.bll.VmHandler.isNumOfMonitorsLegal ( graphicsTypes , numOfMonitors , org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getCanDoActionMessages ( ) ) ; }
Source:
private void setupNetworkClusterDao ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > expectedVdsGroup = java.util.Collections.singletonList ( cluster ) ; org.ovirt.engine.core.dao.VdsGroupDAO vdsGroupDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VdsGroupDAO.class ) ; org.mockito.Mockito.when ( vdsGroupDaoMock.getAllForStoragePool ( storagePoolId ) ) . thenReturn ( expectedVdsGroup ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVdsGroupDao ( ) ) . thenReturn ( vdsGroupDaoMock ) ; }

Target:
private void setupNetworkClusterDao ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDSGroup > expectedVdsGroup = java.util.Collections.singletonList ( cluster ) ; org.ovirt.engine.core.dao.VdsGroupDao vdsGroupDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VdsGroupDao.class ) ; org.mockito.Mockito.when ( vdsGroupDaoMock.getAllForStoragePool ( storagePoolId ) ) . thenReturn ( expectedVdsGroup ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVdsGroupDao ( ) ) . thenReturn ( vdsGroupDaoMock ) ; }
Source:
public static void getStorageConnectionsByDataCenterIdAndStorageType ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { 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.GetConnectionsByDataCenterAndStorageTypeParameters params = new org.ovirt.engine.core.common.queries.GetConnectionsByDataCenterAndStorageTypeParameters ( storagePoolId , storageType ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetConnectionsByDataCenterAndStorageType , params , aQuery ) ; }

Target:
public static void getNextAvailableDiskAliasNameByVMId ( 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.GetNextAvailableDiskAliasNameByVMId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.MacPool model = createIncompleteMacPool ( ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "MacPool" , "add" , getIncompleteFields ( ) ) ; } }

Target:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.MacPool model = createIncompleteMacPool ( ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; verifyIncompleteException ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , ( ) -> org.ovirt.engine.api.restapi.resource.collection.add ( model ) ) , "MacPool" , "add" , getIncompleteFields ( ) ) ; }
Source:
public static void getVmSnapshotList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Snapshot > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Snapshot > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllVmSnapshotsByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , 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.getInstance ( ) . runQuery ( VdcQueryType.GetAllAttachableDisks , params , aQuery ) ; }
Source:
public void recoverFromError ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( getVdsId ( ) ) ; if ( ( vds != null ) && ( ( vds.getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Error ) ) ) { setStatus ( VDSStatus.Up , vds ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDynamicDao ( ) . updateStatus ( getVdsId ( ) , VDSStatus.Up ) ; org.ovirt.engine.core.vdsbroker.VdsManager.log.infoFormat ( "Settings host {0} to up after {1} failed attempts to run a VM" , vds.getName ( ) , mFailedToRunVmAttempts ) ; mFailedToRunVmAttempts.set ( 0 ) ; } }

Target:
public void recoverFromError ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( getVdsId ( ) ) ; if ( ( vds != null ) && ( ( vds.getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Error ) ) ) { setStatus ( VDSStatus.Up , vds ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDynamicDao ( ) . updateStatus ( getVdsId ( ) , VDSStatus.Up ) ; org.ovirt.engine.core.vdsbroker.VdsManager.log.info ( "Settings host '{}' to up after failed attempts to run a VM" , vds.getName ( ) , mFailedToRunVmAttempts ) ; mFailedToRunVmAttempts.set ( 0 ) ; } }
Source:
protected void setUpGetEntityExpectations ( int times , boolean notFound ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : getEntity ( 0 ) ) ) ; } }

Target:
protected void setUpGetEntityExpectations ( int times , boolean notFound ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( QueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , ( notFound ? null : getEntity ( 0 ) ) ) ; } }
Source:
protected void createVirtIODisk ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage disk = getDiskImage ( ) ; disk.setDiskInterface ( DiskInterface.VirtIO ) ; disk.setActive ( true ) ; org.mockito.Mockito.when ( diskDao.get ( diskImageGuid ) ) . thenReturn ( disk ) ; org.mockito.Mockito.when ( osRepository.getDiskHotpluggableInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( new java.util.HashSet < > ( org.ovirt.engine.core.bll.storage.disk.HotPlugDiskToVmCommandTest.DISK_HOTPLUGGABLE_INTERFACES ) ) ; }

Target:
protected void createVirtIODisk ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage disk = mockDiskImage ( ) ; disk.setDiskInterface ( DiskInterface.VirtIO ) ; }
Source:
protected void printReturnValue ( ) { if ( ( ( getReturnValueFromBroker ( ) ) != null ) && ( getIsPrintReturnValue ( ) ) ) { java.lang.StringBuilder builder = new java.lang.StringBuilder ( ) ; org.ovirt.engine.core.vdsbroker.ObjectDescriptor.toStringBuilder ( getReturnValueFromBroker ( ) , builder ) ; log.info ( "Command '{}' return value '{}'" , getClass ( ) . getName ( ) , builder.toString ( ) ) ; if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( getAdditionalInformation ( ) ) ) ) { log.info ( getAdditionalInformation ( ) ) ; } } }

Target:
protected void printReturnValue ( ) { if ( ( ( getReturnValueFromBroker ( ) ) != null ) && ( getIsPrintReturnValue ( ) ) ) { java.lang.StringBuilder builder = new java.lang.StringBuilder ( ) ; org.ovirt.engine.core.utils.ObjectDescriptor.toStringBuilder ( getReturnValueFromBroker ( ) , builder ) ; log.info ( "Command '{}' return value '{}'" , getClass ( ) . getName ( ) , builder.toString ( ) ) ; if ( ! ( org.apache.commons.lang.StringUtils.isEmpty ( getAdditionalInformation ( ) ) ) ) { log.info ( getAdditionalInformation ( ) ) ; } } }
Source:
private org.ovirt.engine.core.common.businessentities.HostDevice getNetDeviceByPciDevice ( final org.ovirt.engine.core.common.businessentities.HostDevice pciDevice ) { return org.ovirt.engine.core.utils.linq.LinqUtils.firstOrNull ( getDevicesByHostId ( pciDevice.getHostId ( ) ) , new org.ovirt.engine.core.utils.linq.Predicate < org.ovirt.engine.core.common.businessentities.HostDevice > ( ) { @ java.lang.Override public boolean eval ( org.ovirt.engine.core.common.businessentities.HostDevice device ) { return pciDevice.getDeviceName ( ) . equals ( device.getParentDeviceName ( ) ) ; } } ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.HostDevice getNetDeviceByPciDevice ( final org.ovirt.engine.core.common.businessentities.HostDevice pciDevice , java.util.Collection < org.ovirt.engine.core.common.businessentities.HostDevice > devices ) { java.util.Collection < org.ovirt.engine.core.common.businessentities.HostDevice > hostDevices = ( devices == null ) ? getDevicesByHostId ( pciDevice.getHostId ( ) ) : devices ; return org.ovirt.engine.core.utils.linq.LinqUtils.firstOrNull ( hostDevices , new org.ovirt.engine.core.utils.linq.Predicate < org.ovirt.engine.core.common.businessentities.HostDevice > ( ) { @ java.lang.Override public boolean eval ( org.ovirt.engine.core.common.businessentities.HostDevice device ) { return pciDevice.getDeviceName ( ) . equals ( device.getParentDeviceName ( ) ) ; } } ) ; }
Source:
public static java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmOsType > get64bitOsTypes ( ) { if ( ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.x64OsTypes ) != null ) { return org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.x64OsTypes ; } org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.x64OsTypes = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmOsType > ( java.util.Arrays.asList ( new org.ovirt.engine.core.common.businessentities.VmOsType [ ] { org.ovirt.engine.core.common.businessentities.VmOsType.RHEL3x64 , org.ovirt.engine.core.common.businessentities.VmOsType.RHEL4x64 , org.ovirt.engine.core.common.businessentities.VmOsType.RHEL5x64 , org.ovirt.engine.core.common.businessentities.VmOsType.RHEL6x64 , org.ovirt.engine.core.common.businessentities.VmOsType.Windows2003x64 , org.ovirt.engine.core.common.businessentities.VmOsType.Windows2008R2x64 , org.ovirt.engine.core.common.businessentities.VmOsType.Windows2008x64 , org.ovirt.engine.core.common.businessentities.VmOsType.Windows7x64 } ) ) ; return org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.x64OsTypes ; }

Target:
public static java.lang.String getOsName ( java.lang.Integer osId ) { if ( osId == null ) { return "" ; } return org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.osNames.get ( osId ) ; }
Source:
public void testMissingBothAlternatives ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Permission permission = new org.ovirt.engine.api.model.Permission ( ) ; permission.setVm ( new org.ovirt.engine.api.model.VM ( ) ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( permission , "user|vm.name|id" ) ; fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Permission" , "user|vm.name|id" ) ; } }

Target:
public void testMissingBothAlternatives ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Permission permission = new org.ovirt.engine.api.model.Permission ( ) ; permission.setVm ( new org.ovirt.engine.api.model.Vm ( ) ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( permission , "user|vm.name|id" ) ; fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Permission" , "user|vm.name|id" ) ; } }
Source:
public void testGetIncludeStatistics ( ) { try { accepts.add ( "application/xml; detail=statistics" ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; org.ovirt.engine.api.model.Vm vm = resource.get ( ) ; org.junit.Assert.assertTrue ( vm.isSetStatistics ( ) ) ; verifyModel ( vm , 0 ) ; } finally { accepts.clear ( ) ; } }

Target:
public void testGetIncludeStatistics ( ) { try { accepts.add ( "application/xml; detail=statistics" ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; setUpGetPayloadExpectations ( 0 , 1 ) ; setUpGetBallooningExpectations ( ) ; setUpGetGraphicsExpectations ( 1 ) ; org.ovirt.engine.api.model.Vm vm = resource.get ( ) ; org.junit.jupiter.api.Assertions.assertTrue ( vm.isSetStatistics ( ) ) ; verifyModel ( vm , 0 ) ; } finally { accepts.clear ( ) ; } }
Source:
private void assertThatNicActuallyExistsOrReferencesNewBondFailed ( org.ovirt.engine.core.bll.network.host.NicLabelValidator validator , org.ovirt.engine.core.common.businessentities.network.NicLabel nicLabel ) { org.junit.Assert.assertThat ( validator.nicActuallyExistsOrReferencesNewBond ( nicLabel ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.INTERFACE_ON_NIC_LABEL_NOT_EXIST , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( "INTERFACE_ON_NIC_LABEL_NOT_EXIST_ENTITY" , nicLabel.getLabel ( ) ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( "interfaceName" , nicLabel.getNicName ( ) ) ) ) ; }

Target:
private void assertThatNicActuallyExistsOrReferencesNewBondFailed ( org.ovirt.engine.core.bll.network.host.NicLabelValidator validator , org.ovirt.engine.core.common.businessentities.network.NicLabel nicLabel ) { org.hamcrest.MatcherAssert.assertThat ( validator.nicActuallyExistsOrReferencesNewBond ( nicLabel ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.INTERFACE_ON_NIC_LABEL_NOT_EXIST , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( "INTERFACE_ON_NIC_LABEL_NOT_EXIST_ENTITY" , nicLabel.getLabel ( ) ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( "interfaceName" , nicLabel.getNicName ( ) ) ) ) ; }
Source:
public void GBThresholdLessThanZero ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 2 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = - 5 ; settings.spaceThresholdPct = 10 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertTrue ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isBelowThresholds ( domain ) ) ; }

Target:
public void GBThresholdLessThanZero ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 2 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = - 5 ; settings.spaceThresholdPct = 10 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertTrue ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isWithinThresholds ( domain ) ) ; }
Source:
public void testGetDefaultQuotaToDCWithoutDefaultQuotaWithNoReuse ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.Quota quotaUnlimited = quotaHelper.getUnlimitedQuota ( mockStoragePool ( ) , true , false ) . getFirst ( ) ; assertQuotaUnlimited ( quotaUnlimited ) ; assertQuotaUnlimitedName ( quotaUnlimited ) ; }

Target:
public void testGetDefaultQuotaForDCWithDefaultQuota ( ) throws java.lang.Exception { org.mockito.Mockito.when ( quotaDAO.getDefaultQuotaByStoragePoolId ( storagePoolUUID ) ) . thenReturn ( mockGeneralStorageQuota ( ) ) ; java.lang.String defaultQuotaName = quotaHelper.getDefaultQuotaName ( storagePool.getname ( ) ) ; org.mockito.Mockito.when ( quotaHelper.generateDefaultQuotaName ( storagePool ) ) . thenReturn ( defaultQuotaName ) ; org.ovirt.engine.core.common.businessentities.Quota quotaUnlimited = quotaHelper.getUnlimitedQuota ( mockStoragePool ( ) , true ) ; assertQuotaUnlimited ( quotaUnlimited ) ; assertQuotaUnlimitedName ( quotaUnlimited ) ; }
Source:
public boolean StorageDomainRemoved ( org.ovirt.engine.core.common.businessentities.storage_domain_static storageDomain ) { org.ovirt.engine.core.common.businessentities.storage_server_connections connection = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageServerConnectionDao ( ) . get ( storageDomain.getstorage ( ) ) ; if ( connection != null ) { org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageServerConnectionDao ( ) . remove ( connection.getid ( ) ) ; } return true ; }

Target:
public boolean StorageDomainRemoved ( org.ovirt.engine.core.common.businessentities.StorageDomainStatic storageDomain ) { org.ovirt.engine.core.common.businessentities.storage_server_connections connection = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageServerConnectionDao ( ) . get ( storageDomain.getstorage ( ) ) ; if ( connection != null ) { org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageServerConnectionDao ( ) . remove ( connection.getid ( ) ) ; } return true ; }
Source:
public static void getVmConfigurationBySnapshot ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid snapshotSourceId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( org.ovirt.engine.core.common.businessentities.VM ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetVmConfigurationBySnapshot , new org.ovirt.engine.core.common.queries.IdQueryParameters ( snapshotSourceId ) , aQuery ) ; }

Target:
public static void getDiskList ( 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.DiskImage > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ; } } ; org.ovirt.engine.core.common.queries.SearchParameters searchParams = new org.ovirt.engine.core.common.queries.SearchParameters ( "Disks:" , org.ovirt.engine.core.common.interfaces.SearchType.Disk ) ; searchParams.setMaxCount ( 9999 ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.Search , searchParams , aQuery ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.Snapshot addActiveSnapshot ( org.ovirt.engine.core.compat.Guid snapshotId ) { return snapshotsManager.addActiveSnapshot ( snapshotId , getVm ( ) , getMemoryVolumeForNewActiveSnapshot ( ) , org.ovirt.engine.core.bll.ImportVmCommand.getCompensationContext ( ) ) ; }

Target:
protected org.ovirt.engine.core.common.businessentities.Snapshot addActiveSnapshot ( org.ovirt.engine.core.compat.Guid snapshotId ) { org.ovirt.engine.core.common.businessentities.Snapshot activeSnapshot = getActiveSnapshot ( ) ; java.lang.String memoryVolume = ( ( activeSnapshot != null ) && ( ! ( org.ovirt.engine.core.bll.ImportVmCommand.getParameters ( ) . isImportAsNewEntity ( ) ) ) ) ? activeSnapshot.getMemoryVolume ( ) : org.apache.commons.lang.StringUtils.EMPTY ; return snapshotsManager.addActiveSnapshot ( snapshotId , getVm ( ) , memoryVolume , org.ovirt.engine.core.bll.ImportVmCommand.getCompensationContext ( ) ) ; }
Source:
protected java.lang.String getColumnWidthKey ( com.google.gwt.user.cellview.client.Column < T , ? > column ) { if ( columnResizePersistenceEnabled ) { return ( ( ( ( org.ovirt.engine.ui.common.widget.table.resize.ColumnResizeCellTable.GRID_COLUMN_WIDTH_PREFIX ) + "_" ) + ( gridController.getId ( ) ) ) + "_" ) + ( getColumnIndex ( column ) ) ; } return null ; }

Target:
protected java.lang.String getColumnWidthKey ( com.google.gwt.user.cellview.client.Column < T , ? > column ) { if ( columnResizePersistenceEnabled ) { return ( ( ( ( org.ovirt.engine.ui.common.widget.table.resize.ColumnResizeCellTable.GRID_COLUMN_WIDTH_PREFIX ) + "_" ) + ( getGridElementId ( ) ) ) + "_" ) + ( getColumnIndex ( column ) ) ; } return null ; }
Source:
private void doTestBadUpdate ( boolean valid , boolean success , java.lang.String detail ) { setUpEntityQueryExpectations ( 1 ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateNetwork , org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters.class , new java.lang.String [ ] { "StoragePoolId" } , new java.lang.Object [ ] { GUIDS [ 1 ] } , valid , success ) ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.AbstractBackendNetworksResourceTest.getModel ( 0 ) ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }

Target:
private void doTestBadUpdate ( boolean valid , boolean success , java.lang.String detail ) { setUpEntityQueryExpectations ( 1 ) ; setUriInfo ( setUpActionExpectations ( ActionType.UpdateNetwork , org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters.class , new java.lang.String [ ] { "StoragePoolId" } , new java.lang.Object [ ] { GUIDS [ 1 ] } , valid , success ) ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.AbstractBackendNetworksResourceTest.getModel ( 0 ) ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }
Source:
protected org.ovirt.engine.api.model.VM populate ( org.ovirt.engine.api.model.VM model , org.ovirt.engine.api.model.VM entity ) { java.util.Set < org.ovirt.engine.api.common.util.DetailHelper.Detail > details = org.ovirt.engine.api.common.util.DetailHelper.getDetails ( getHttpHeaders ( ) ) ; model = addInlineDetails ( details , model ) ; if ( details.contains ( Detail.STATISTICS ) ) { addInlineStatistics ( model ) ; } return model ; }

Target:
protected org.ovirt.engine.api.model.VM deprecatedPopulate ( org.ovirt.engine.api.model.VM model , org.ovirt.engine.api.model.VM entity ) { java.util.Set < org.ovirt.engine.api.common.util.DetailHelper.Detail > details = org.ovirt.engine.api.common.util.DetailHelper.getDetails ( getHttpHeaders ( ) ) ; model = addInlineDetails ( details , model ) ; if ( details.contains ( Detail.STATISTICS ) ) { addInlineStatistics ( model ) ; } return model ; }