auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void initCache ( org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.CacheConfigValues ( new org.ovirt.engine.ui.frontend.AsyncQuery ( loginModel , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( target ) ; } } ) ) ; }

Target:
public static void initCache ( org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.cacheConfigValues ( new org.ovirt.engine.ui.frontend.AsyncQuery ( loginModel , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( target ) ; } } ) ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.initOsNames ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.initUniqueOsNames ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.initLinuxOsTypes ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.initWindowsOsTypes ( ) ; }
Source:
public void diskPluggedToVmsNotAsSnapshotSuccess ( ) { java.util.List < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.businessentities.VM , org.ovirt.engine.core.common.businessentities.VmDevice > > vmsInfo = prepareForCheckingIfDiskPluggedToVmsThatAreNotDown ( ) ; vmsInfo.get ( 0 ) . getFirst ( ) . setStatus ( VMStatus.Up ) ; vmsInfo.get ( 1 ) . getFirst ( ) . setStatus ( VMStatus.Up ) ; org.junit.Assert.assertThat ( validator.isDiskPluggedToVmsThatAreNotDown ( true , vmsInfo ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void testDiskAttachedToAnyNonDownVM ( ) { org.junit.Assert.assertThat ( validator.isDiskPluggedToAnyNonDownVm ( false ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
public void testRemove ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 1 ) ; setUpGetGraphicsExpectations ( 1 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.RemoveVmTemplate , org.ovirt.engine.core.common.action.VmTemplateParametersBase.class , new java.lang.String [ ] { "VmTemplateId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , true , true ) ) ; verifyRemove ( resource.remove ( ) ) ; }

Target:
public void testRemove ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 1 ) ; setUpGetGraphicsExpectations ( 1 ) ; setUpGetBallooningExpectations ( ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.RemoveVmTemplate , org.ovirt.engine.core.common.action.VmTemplateParametersBase.class , new java.lang.String [ ] { "VmTemplateId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , true , true ) ) ; verifyRemove ( resource.remove ( ) ) ; }
Source:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } if ( ( ! ( isRngSupportedByCluster ( ) ) ) && ( ( getTemplateType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.INSTANCE_TYPE ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_POOL_LEVEL ) ; } if ( ! ( getRngDevices ( ) . isEmpty ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS ) ; } return true ; }

Target:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } if ( ( getTemplateType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.INSTANCE_TYPE ) ) { if ( ! ( validate ( getVirtioRngValidator ( ) . canAddRngDevice ( getVdsGroup ( ) , getParameters ( ) . getRngDevice ( ) ) ) ) ) { return false ; } } if ( ! ( getRngDevices ( ) . isEmpty ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS ) ; } return true ; }
Source:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlanSyncedWithNetwork ( java.lang.String nicName , org.ovirt.engine.core.common.businessentities.network.Network network ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createVlan ( nicName , network.getVlanId ( ) , network.getName ( ) ) ; nic.setBridged ( network.isVmNetwork ( ) ) ; nic.setMtu ( network.getMtu ( ) ) ; return nic ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlanSyncedWithNetwork ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface baseNic , org.ovirt.engine.core.common.businessentities.network.Network network ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createVlan ( baseNic , network.getVlanId ( ) , network.getName ( ) ) ; nic.setBridged ( network.isVmNetwork ( ) ) ; nic.setMtu ( network.getMtu ( ) ) ; return nic ; }
Source:
public void runFailedAutoStartVM ( org.ovirt.engine.core.compat.Guid vmId ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase event = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; event.setVmId ( vmId ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log ( event , AuditLogType.HA_VM_FAILED ) ; final org.ovirt.engine.core.common.action.VdcReturnValueBase result = org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.RunVm , new org.ovirt.engine.core.common.action.RunVmParams ( vmId ) , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log ( event , AuditLogType.HA_VM_RESTART_FAILED ) ; } }

Target:
public void runFailedAutoStartVM ( org.ovirt.engine.core.compat.Guid vmId ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase event = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; event.setVmId ( vmId ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log ( event , AuditLogType.HA_VM_FAILED ) ; org.ovirt.engine.core.bll.VdsEventListener.log.infoFormat ( "Failed to start Highly Available VM. Attempting to restart. VM Name: {0}, VM Id:{1}" , event.getVmName ( ) , vmId ) ; final org.ovirt.engine.core.common.action.VdcReturnValueBase result = org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.RunVm , new org.ovirt.engine.core.common.action.RunVmParams ( vmId ) , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log ( event , AuditLogType.HA_VM_RESTART_FAILED ) ; } }
Source:
private void writeCleanup ( ) { logger.log ( Type.DEBUG , ( "Starting to write cleanup impl. for editor " + ( model.getEditorType ( ) . getQualifiedSourceName ( ) ) ) ) ; sw.println ( ) ; sw.println ( "@Override" ) ; sw.println ( "public void cleanup() {" ) ; sw.indent ( ) ; java.util.Set < java.lang.String > editorFieldExpressions = getEditorFieldCleanupExpressions ( ) ; for ( java.lang.String expr : editorFieldExpressions ) { sw.println ( java.lang.String.format ( "if (%s != null) {" , expr ) ) ; sw.indent ( ) ; sw.println ( java.lang.String.format ( "%s.cleanup();" , expr ) ) ; sw.outdent ( ) ; sw.println ( "}" ) ; } java.util.Set < java.lang.String > modelExpressions = getModelCleanupExpressions ( ) ; if ( ! ( modelExpressions.isEmpty ( ) ) ) { sw.println ( "if (getObject() != null) {" ) ; sw.indent ( ) ; for ( java.lang.String expr : modelExpressions ) { sw.println ( java.lang.String.format ( "%s.cleanup();" , expr ) ) ; } sw.outdent ( ) ; sw.println ( "}" ) ; } sw.outdent ( ) ; sw.println ( "}" ) ; }

Target:
private void writeCleanup ( ) { logger.log ( Type.DEBUG , ( "Starting to write cleanup impl. for editor " + ( model.getEditorType ( ) . getQualifiedSourceName ( ) ) ) ) ; sw.println ( ) ; sw.println ( "@Override" ) ; sw.println ( "public void cleanup() {" ) ; sw.indent ( ) ; java.util.Set < java.lang.String > editorFieldExpressions = getEditorFieldCleanupExpressions ( ) ; for ( java.lang.String expr : editorFieldExpressions ) { sw.println ( java.lang.String.format ( "if (%s != null) {" , expr ) ) ; sw.indent ( ) ; sw.println ( java.lang.String.format ( "%s.cleanup();" , expr ) ) ; sw.outdent ( ) ; sw.println ( "}" ) ; } java.util.Set < java.lang.String > modelExpressions = getModelCleanupExpressions ( ) ; if ( ! ( modelExpressions.isEmpty ( ) ) ) { sw.println ( "if (getObject() != null) {" ) ; sw.indent ( ) ; for ( java.lang.String expr : modelExpressions ) { sw.println ( java.lang.String.format ( "%s.cleanup();" , expr ) ) ; } sw.outdent ( ) ; sw.println ( "}" ) ; } sw.println ( "cleanupEditorDriver();" ) ; sw.outdent ( ) ; sw.println ( "}" ) ; }
Source:
public void testUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 2 ) ; setAllContentHeaderExpectation ( ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.UpdateVmInterface , org.ovirt.engine.core.common.action.AddVmInterfaceParameters.class , new java.lang.String [ ] { "VmId" , "Interface.Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.AbstractBackendNicsResourceTest.PARENT_ID , GUIDS [ 1 ] } , true , true ) ) ; org.ovirt.engine.api.model.Nic nic = resource.update ( getNic ( false ) ) ; assertNotNull ( nic ) ; }

Target:
public void testUpdate ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 2 ) ; setAllContentHeaderExpectation ( ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.UpdateVmInterface , org.ovirt.engine.core.common.action.AddVmInterfaceParameters.class , new java.lang.String [ ] { "VmId" , "Interface.Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmNicResourceTest.VM_ID , org.ovirt.engine.api.restapi.resource.BackendVmNicResourceTest.NIC_ID } , true , true ) ) ; org.ovirt.engine.api.model.Nic nic = resource.update ( getNic ( false ) ) ; assertNotNull ( nic ) ; }
Source:
public static void getTemplateDiskList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid templateId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetVmTemplatesDisks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( templateId ) , aQuery ) ; }

Target:
public static void isSoundcardEnabled ( 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 ) { if ( source != null ) { return ( ( ( java.util.List < java.lang.String > ) ( source ) ) . size ( ) ) > 0 ; } return false ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetSoundDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
public void testEvalDifferentAddress ( ) throws java.lang.Exception { org.mockito.Mockito.when ( mockOtherIface.getName ( ) ) . thenReturn ( org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicateTest.TEST_INTERFACE_NAME ) ; org.mockito.Mockito.when ( mockOtherIface.getAddress ( ) ) . thenReturn ( ( "not" + ( org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicateTest.TEST_INTERFACE_ADDRESS ) ) ) ; junit.framework.Assert.assertFalse ( underTest.eval ( mockOtherIface ) ) ; }

Target:
public void testEvalDifferentAddress ( ) throws java.lang.Exception { org.mockito.Mockito.when ( mockOtherIface.getName ( ) ) . thenReturn ( org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicateTest.TEST_INTERFACE_NAME ) ; org.mockito.Mockito.when ( mockOtherIface.getAddress ( ) ) . thenReturn ( ( "not" + ( org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicateTest.TEST_INTERFACE_ADDRESS ) ) ) ; org.junit.Assert.assertFalse ( underTest.eval ( mockOtherIface ) ) ; }
Source:
public void getVolumeSnapshotSchedule ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid volumeId ) { 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.GetGlusterVolumeSnapshotScheduleByVolumeId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( volumeId ) , aQuery ) ; }

Target:
public void getVolumeSnapshotSchedule ( org.ovirt.engine.ui.frontend.AsyncQuery < org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule > aQuery , org.ovirt.engine.core.compat.Guid volumeId ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.CastingConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeSnapshotScheduleByVolumeId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( volumeId ) , aQuery ) ; }
Source:
public void calculateNetworkImplementationDetailsNetworkQosOverridden ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNetworkDevice ( ) ; iface.setQosOverridden ( true ) ; calculateNetworkImplementationDetailsAndAssertSync ( iface , true , iface.isBridged ( ) , iface.getMtu ( ) , iface.getVlanId ( ) , new org.ovirt.engine.core.common.businessentities.network.NetworkQoS ( ) ) ; }

Target:
public void calculateNetworkImplementationDetailsNetworkQosOutOfSync ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface = createNetworkDevice ( ) ; org.ovirt.engine.core.common.businessentities.network.HostNetworkQos qos = new org.ovirt.engine.core.common.businessentities.network.HostNetworkQos ( ) ; qos.setOutAverageLinkshare ( 60 ) ; qos.setOutAverageUpperlimit ( 60 ) ; qos.setOutAverageRealtime ( 60 ) ; calculateNetworkImplementationDetailsAndAssertSync ( iface , false , iface.isBridged ( ) , iface.getMtu ( ) , iface.getVlanId ( ) , qos ) ; }
Source:
public org.ovirt.engine.core.common.action.VdcReturnValueBase endAction ( ) { org.ovirt.engine.core.bll.job.ExecutionHandler.startFinalizingStep ( getExecutionContext ( ) ) ; try { setActionState ( ) ; handleTransactivity ( ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( endActionScope , this ) ; } catch ( javax.ejb.TransactionRolledbackLocalException e ) { log.infoFormat ( "EndAction: Transaction was aborted in {0}" , this . getClass ( ) . getName ( ) ) ; } finally { if ( getCommandShouldBeLogged ( ) ) { logCommand ( ) ; } } return getReturnValue ( ) ; }

Target:
public org.ovirt.engine.core.common.action.VdcReturnValueBase endAction ( ) { org.ovirt.engine.core.bll.job.ExecutionHandler.startFinalizingStep ( getExecutionContext ( ) ) ; try { initiateLockEndAction ( ) ; setActionState ( ) ; handleTransactivity ( ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( endActionScope , this ) ; } catch ( javax.ejb.TransactionRolledbackLocalException e ) { log.infoFormat ( "EndAction: Transaction was aborted in {0}" , this . getClass ( ) . getName ( ) ) ; } finally { freeLock ( ) ; if ( getCommandShouldBeLogged ( ) ) { logCommand ( ) ; } } return getReturnValue ( ) ; }
Source:
public void ExecuteCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . ExecuteCommand ( command ) ; if ( command == ( getRestoreCommand ( ) ) ) { Restore ( ) ; } else if ( command == ( getRemoveCommand ( ) ) ) { remove ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "Cancel" ) ) { Cancel ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "CancelConfirm" ) ) { CancelConfirm ( ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getRestoreCommand ( ) ) ) { Restore ( ) ; } else if ( command == ( getRemoveCommand ( ) ) ) { remove ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "Cancel" ) ) { Cancel ( ) ; } else if ( org.ovirt.engine.core.compat.StringHelper.stringsEqual ( command.getName ( ) , "CancelConfirm" ) ) { CancelConfirm ( ) ; } }
Source:
private void verifyServiceOnServer1 ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService service ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE1_ID , service.getServiceId ( ) . toString ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.PID_1 , service.getPid ( ) ) ; org.junit.Assert.assertEquals ( GlusterServiceStatus.RUNNING , service.getStatus ( ) ) ; }

Target:
private void verifyServiceOnServer1 ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService service ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE1_ID , service.getServiceId ( ) . toString ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE1_NAME , service.getServiceName ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVICE1_TYPE , service.getServiceType ( ) ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.PID_1 , service.getPid ( ) ) ; org.junit.Assert.assertEquals ( GlusterServiceStatus.RUNNING , service.getStatus ( ) ) ; }
Source:
private static boolean ValidateSubscription ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.event_subscriber > subscriptions , org.ovirt.engine.core.common.businessentities.event_subscriber current ) { boolean retValue = false ; for ( org.ovirt.engine.core.common.businessentities.event_subscriber event_subscriber : subscriptions ) { if ( ( ( event_subscriber.getsubscriber_id ( ) . equals ( current.getsubscriber_id ( ) ) ) && ( org.apache.commons.lang.StringUtils.equals ( event_subscriber.getevent_up_name ( ) , current.getevent_up_name ( ) ) ) ) && ( ( event_subscriber.getmethod_id ( ) ) == ( current.getmethod_id ( ) ) ) ) { retValue = true ; break ; } } return retValue ; }

Target:
private static boolean ValidateSubscription ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.event_subscriber > subscriptions , org.ovirt.engine.core.common.businessentities.event_subscriber current ) { boolean retValue = false ; for ( org.ovirt.engine.core.common.businessentities.event_subscriber event_subscriber : subscriptions ) { if ( ( ( event_subscriber.getsubscriber_id ( ) . equals ( current.getsubscriber_id ( ) ) ) && ( org.apache.commons.lang.StringUtils.equals ( event_subscriber.getevent_up_name ( ) , current.getevent_up_name ( ) ) ) ) && ( ( event_subscriber.getevent_notification_method ( ) ) == ( current.getevent_notification_method ( ) ) ) ) { retValue = true ; break ; } } return retValue ; }
Source:
public void setUp ( ) throws java.lang.Exception { testServlet = new org.ovirt.engine.core.utils.servlet.FileServlet ( ) ; javax.servlet.ServletContext mockContext = org.mockito.Mockito.mock ( javax.servlet.ServletContext.class ) ; org.mockito.Mockito.when ( mockConfig.getServletContext ( ) ) . thenReturn ( mockContext ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { file = new java.io.File ( this . getClass ( ) . getResource ( "small_file.txt" ) . toURI ( ) ) ; testServlet = new org.ovirt.engine.core.utils.servlet.FileServlet ( ) ; javax.servlet.ServletContext mockContext = org.mockito.Mockito.mock ( javax.servlet.ServletContext.class ) ; org.mockito.Mockito.when ( mockConfig.getServletContext ( ) ) . thenReturn ( mockContext ) ; }
Source:
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.ExternalHostGroup > ( ) ; } return source ; }

Target:
public void getExternalProviderHostGroupList ( org.ovirt.engine.ui.frontend.AsyncQuery < java.util.List < org.ovirt.engine.core.common.businessentities.ExternalHostGroup > > aQuery , org.ovirt.engine.core.common.businessentities.Provider provider ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.ListConverter < > ( ) ; org.ovirt.engine.core.common.queries.ProviderQueryParameters params = new org.ovirt.engine.core.common.queries.ProviderQueryParameters ( ) ; params.setProvider ( provider ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetHostGroupsFromExternalProvider , params , aQuery ) ; }
Source:
public void getClusterById ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClusterById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }

Target:
public void getExternalProviderComputeResourceList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.common.businessentities.Provider provider ) { 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.ExternalComputeResource > ( ) ; } return source ; } } ; org.ovirt.engine.core.common.queries.ProviderQueryParameters params = new org.ovirt.engine.core.common.queries.ProviderQueryParameters ( ) ; params.setProvider ( provider ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetComputeResourceFromExternalProvider , params , aQuery ) ; }
Source:
public static java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.DiskImage > getDiskImagesByIdMap ( java.util.Collection < org.ovirt.engine.core.common.businessentities.DiskImage > diskImages ) { java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.DiskImage > result = new java.util.HashMap < > ( ) ; if ( diskImages != null ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : diskImages ) { result.put ( diskImage.getImageId ( ) , diskImage ) ; } } return result ; }

Target:
public static java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.storage.DiskImage > getDiskImagesByIdMap ( java.util.Collection < org.ovirt.engine.core.common.businessentities.storage.DiskImage > diskImages ) { java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.storage.DiskImage > result = new java.util.HashMap < > ( ) ; if ( diskImages != null ) { for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskImages ) { result.put ( diskImage.getImageId ( ) , diskImage ) ; } } return result ; }
Source:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.ImageTransfer imageTransfer ) { org.ovirt.engine.core.common.action.TransferDiskImageParameters params = new org.ovirt.engine.core.common.action.TransferDiskImageParameters ( ) ; if ( ( imageTransfer.isSetDirection ( ) ) && ( ( imageTransfer.getDirection ( ) ) == ( org.ovirt.engine.api.model.ImageTransferDirection.DOWNLOAD ) ) ) { params.setTransferType ( TransferType.Download ) ; } params.setImageId ( org.ovirt.engine.api.restapi.utils.GuidUtils.asGuid ( imageTransfer.getImage ( ) . getId ( ) ) ) ; return performCreate ( ActionType.TransferDiskImage , params , new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.QueryType.GetImageTransferById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ) ; }

Target:
private javax.ws.rs.core.Response performCreate ( org.ovirt.engine.api.model.ImageTransfer imageTransfer , org.ovirt.engine.core.common.action.TransferDiskImageParameters params ) { updateTransferType ( imageTransfer , params ) ; return performCreate ( ActionType.TransferDiskImage , params , new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.QueryType.GetImageTransferById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ) ; }
Source:
private void queryNetworks ( ) { org.ovirt.engine.ui.frontend.AsyncQuery asyncQuery = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; asyncQuery.setModel ( this ) ; asyncQuery.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { allNetworks = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > ) ( returnValue ) ) ; queryQoss ( ) ; } } ; org.ovirt.engine.core.common.businessentities.VDS vds = getEntity ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getClusterNetworkList ( asyncQuery , vds.getClusterId ( ) ) ; }

Target:
private void queryNetworks ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = getEntity ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getClusterNetworkList ( new org.ovirt.engine.ui.uicommonweb.models.hosts.AsyncQuery ( new org.ovirt.engine.ui.frontend.AsyncCallback < java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > > ( ) { @ java.lang.Override public void onSuccess ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > returnValue ) { allNetworks = returnValue ; queryQoss ( ) ; } } ) , vds.getClusterId ( ) ) ; }
Source:
private org.ovirt.engine.core.common.action.VdcActionParametersBase createUpgradeParameteres ( org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters parameters ) { org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters upgradeParams = new org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters ( parameters.getVdsId ( ) ) ; upgradeParams.setSessionId ( parameters.getSessionId ( ) ) ; upgradeParams.setCorrelationId ( parameters.getCorrelationId ( ) ) ; upgradeParams.setInitialStatus ( parameters.getInitialStatus ( ) ) ; upgradeParams.setoVirtIsoFile ( parameters.getoVirtIsoFile ( ) ) ; upgradeParams.setParentCommand ( VdcActionType.UpgradeHost ) ; upgradeParams.setParentParameters ( parameters ) ; return upgradeParams ; }

Target:
private org.ovirt.engine.core.common.action.VdcActionParametersBase createUpgradeParameters ( org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters parameters ) { org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters upgradeParams = new org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters ( parameters.getVdsId ( ) ) ; upgradeParams.setSessionId ( parameters.getSessionId ( ) ) ; upgradeParams.setCorrelationId ( parameters.getCorrelationId ( ) ) ; upgradeParams.setInitialStatus ( parameters.getInitialStatus ( ) ) ; upgradeParams.setoVirtIsoFile ( parameters.getoVirtIsoFile ( ) ) ; upgradeParams.setParentCommand ( VdcActionType.UpgradeHost ) ; upgradeParams.setParentParameters ( parameters ) ; return upgradeParams ; }
Source:
public java.lang.Void runInTransaction ( ) { addVmStatic ( ) ; addVmDynamic ( ) ; addVmInterfaces ( ) ; addVmStatistics ( ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { addVmImagesAndSnapshots ( ) ; updateSnapshotsFromExport ( ) ; if ( useCopyImages ) { moveOrCopyAllImageGroups ( ) ; } org.ovirt.engine.core.bll.utils.VmDeviceUtils.addImportedDevices ( getVm ( ) . getStaticData ( ) , getParameters ( ) . isImportAsNewEntity ( ) ) ; if ( getParameters ( ) . isImportAsNewEntity ( ) ) { getParameters ( ) . setVm ( getVm ( ) ) ; setVmId ( getVm ( ) . getId ( ) ) ; } return null ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { dcLabels = ( ( java.util.SortedSet < java.lang.String > ) ( returnValue ) ) ; initNicModels ( ) ; stopProgress ( ) ; }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand uiCommand ) { if ( ! ( labelPopup.validate ( ) ) ) { return ; } sourceListModel.setConfirmWindow ( null ) ; java.lang.String label = labelPopup.getLabel ( ) . getEntity ( ) ; dcLabels.add ( label ) ; NetworkOperation.LABEL.getCommand ( new org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel ( label , this ) , networkCommand.getOp2 ( ) , hostSetupNetworksParametersData ) . execute ( ) ; redraw ( ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.OneLUNReturnForXmlRpc getDeviceInfo ( java.lang.String devGUID ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.getDeviceInfo ( devGUID ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.OneLUNReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.OneLUNReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterHookUpdate ( java.lang.String glusterCommand , java.lang.String stage , java.lang.String hookName , java.lang.String content , java.lang.String checksum ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterHookUpdate ( glusterCommand , stage , hookName , content , checksum ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
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 isSameSourceProfile ( org.ovirt.engine.ui.uicommonweb.models.vms.register.VnicProfileMappingEntity other ) { return externalVnicProfileMapping.isSameSourceProfile ( other.externalVnicProfileMapping ) ; }
Source:
private static void updateTimeoutLogableObject ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase auditLogable , org.ovirt.engine.core.common.AuditLogType logType ) { if ( ( logType.getDuplicateEventsIntervalValue ( ) ) > 0 ) { auditLogable.setEndTime ( org.ovirt.engine.core.compat.DateTime.getNow ( ) . AddSeconds ( logType.getDuplicateEventsIntervalValue ( ) ) ) ; auditLogable.setTimeoutObjectId ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.ComposeObjectId ( auditLogable , logType ) ) ; } }

Target:
private static void updateTimeoutLogableObject ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase auditLogable , org.ovirt.engine.core.common.AuditLogType logType ) { int duplicateEventsIntrvalValue = ( auditLogable.isExternal ( ) ) ? java.lang.Math.max ( auditLogable.getEventFloodInSec ( ) , 30 ) : logType.getDuplicateEventsIntervalValue ( ) ; if ( duplicateEventsIntrvalValue > 0 ) { auditLogable.setEndTime ( org.ovirt.engine.core.compat.DateTime.getNow ( ) . AddSeconds ( logType.getDuplicateEventsIntervalValue ( ) ) ) ; auditLogable.setTimeoutObjectId ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.ComposeObjectId ( auditLogable , logType ) ) ; } }
Source:
public static java.lang.String getRequestParameter ( javax.servlet.http.HttpServletRequest request , java.lang.String paramName ) throws java.lang.Exception { java.lang.String value = org.ovirt.engine.core.sso.utils.SSOUtils.getParameter ( request , paramName ) ; if ( value == null ) { throw new org.ovirt.engine.core.sso.utils.OAuthException ( SSOConstants.ERR_CODE_INVALID_REQUEST , java.lang.String.format ( SSOConstants.ERR_CODE_INVALID_REQUEST_MSG , paramName ) ) ; } return java.net.URLDecoder.decode ( value , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; }

Target:
public static java.lang.String decode ( java.lang.String value ) throws java.io.UnsupportedEncodingException { return java.net.URLDecoder.decode ( value , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVmPoolDao ( ) ; vmDao = dbFacade.getVmDao ( ) ; existingVmPool = dao.get ( org.ovirt.engine.core.dao.VmPoolDaoTest.EXISTING_VM_POOL_ID ) ; deletableVmPool = dao.get ( org.ovirt.engine.core.dao.VmPoolDaoTest.DELETABLE_VM_POOL_ID ) ; newVmPool = new org.ovirt.engine.core.common.businessentities.VmPool ( ) ; newVmPool.setName ( "New VM Pool" ) ; newVmPool.setVmPoolDescription ( "This is a new VM pool." ) ; newVmPool.setClusterId ( org.ovirt.engine.core.dao.VmPoolDaoTest.CLUSTER_ID ) ; newVmPoolMap = new org.ovirt.engine.core.common.businessentities.VmPoolMap ( org.ovirt.engine.core.dao.VmPoolDaoTest.FREE_VM_ID , org.ovirt.engine.core.dao.VmPoolDaoTest.EXISTING_VM_POOL_ID ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVmPoolDao ( ) ; vmDao = dbFacade.getVmDao ( ) ; existingVmPool = dao.get ( org.ovirt.engine.core.dao.VmPoolDaoTest.EXISTING_VM_POOL_ID ) ; deletableVmPool = dao.get ( org.ovirt.engine.core.dao.VmPoolDaoTest.DELETABLE_VM_POOL_ID ) ; newVmPool = new org.ovirt.engine.core.common.businessentities.VmPool ( ) ; newVmPool.setName ( "New VM Pool" ) ; newVmPool.setVmPoolDescription ( "This is a new VM pool." ) ; newVmPool.setClusterId ( FixturesTool.CLUSTER ) ; newVmPoolMap = new org.ovirt.engine.core.common.businessentities.VmPoolMap ( org.ovirt.engine.core.dao.VmPoolDaoTest.FREE_VM_ID , org.ovirt.engine.core.dao.VmPoolDaoTest.EXISTING_VM_POOL_ID ) ; }
Source:
private void retryCall ( final org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request , final org.ovirt.vdsm.jsonrpc.client.internal.JsonRpcCall call ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { org.ovirt.vdsm.jsonrpc.client.utils.ResponseTracking tracking = new org.ovirt.vdsm.jsonrpc.client.utils.ResponseTracking ( request , call , new org.ovirt.vdsm.jsonrpc.client.utils.retry.RetryContext ( policy ) , org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.getTimeout ( this . policy.getRetryTimeOut ( ) , this . policy.getTimeUnit ( ) ) , this . client ) ; this . tracker.registerTrackingRequest ( request , tracking ) ; }

Target:
private void retryCall ( final org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request , final org.ovirt.vdsm.jsonrpc.client.internal.JsonRpcCall call ) throws org.ovirt.vdsm.jsonrpc.client.ClientConnectionException { org.ovirt.vdsm.jsonrpc.client.utils.ResponseTracking tracking = new org.ovirt.vdsm.jsonrpc.client.utils.ResponseTracking ( request , call , new org.ovirt.vdsm.jsonrpc.client.utils.retry.RetryContext ( policy ) , org.ovirt.vdsm.jsonrpc.client.utils.JsonUtils.getTimeout ( this . policy.getRetryTimeOut ( ) , this . policy.getTimeUnit ( ) ) , this . client , ( ( request.getMethod ( ) ) != "Host.ping" ) ) ; this . tracker.registerTrackingRequest ( request , tracking ) ; }
Source:
public org.ovirt.engine.core.common.businessentities.StoragePool getStoragePool ( ) { if ( ( cachedStoragePool ) == null ) { cachedStoragePool = getStoragePoolDao ( ) . get ( params.getStoragePoolId ( ) ) ; } return cachedStoragePool ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult verifyDisks ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.storage.DiskImage > imageList , java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.compat.Guid > imageToDestinationDomainMap ) { if ( ( ! ( params.isImportAsNewEntity ( ) ) ) && ( ! ( params.isImagesExistOnTargetStorageDomain ( ) ) ) ) { return new org.ovirt.engine.core.bll.validator.storage.DiskImagesValidator ( imageList ) . diskImagesOnStorage ( imageToDestinationDomainMap ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
public void confFileConvertToMapFails ( ) throws java.io.IOException , java.net.URISyntaxException { givenListOfImagesAndVolumes ( ) ; givenTheWantedDiskImage ( ) ; mockVdsCommand ( VDSCommandType.RetrieveImageData , successfulReturnValue ( load ( "not-a-valid-hosted-engine-config-tar.tar" ) ) ) ; java.util.Map < java.lang.String , java.lang.String > config = fetchConfig ( ) ; verifyCalled ( VDSCommandType.RetrieveImageData , org.mockito.Mockito.times ( 1 ) ) ; org.junit.Assert.assertThat ( config , org.hamcrest.core.Is.is ( java.util.Collections.emptyMap ( ) ) ) ; }

Target:
public void confFileConvertToMapFails ( ) throws java.io.IOException , java.net.URISyntaxException { givenListOfImagesAndVolumes ( ) ; givenTheWantedDiskImage ( ) ; mockVdcCommand ( VdcActionType.RetrieveImageData , successfulVdcReturnValue ( load ( "not-a-valid-hosted-engine-config-tar.tar" ) ) ) ; java.util.Map < java.lang.String , java.lang.String > config = fetchConfig ( ) ; verifyCalled ( VdcActionType.RetrieveImageData , org.mockito.Mockito.times ( 1 ) ) ; org.junit.Assert.assertThat ( config , org.hamcrest.core.Is.is ( java.util.Collections.emptyMap ( ) ) ) ; }
Source:
public org.ovirt.engine.api.extensions.Extension load ( java.util.Properties props ) throws java.lang.Exception { return ( ( org.ovirt.engine.api.extensions.Extension ) ( lookupService ( org.ovirt.engine.api.extensions.Extension.class , props.getProperty ( Base.ConfigKeys.BINDINGS_JBOSSMODULE_CLASS ) , props.getProperty ( Base.ConfigKeys.BINDINGS_JBOSSMODULE_MODULE ) ) . newInstance ( ) ) ) ; }

Target:
public org.ovirt.engine.core.extensions.mgr.ExtensionProxy load ( java.util.Properties props ) throws java.lang.Exception { org.jboss.modules.Module module = loadModule ( props.getProperty ( Base.ConfigKeys.BINDINGS_JBOSSMODULE_MODULE ) ) ; return new org.ovirt.engine.core.extensions.mgr.ExtensionProxy ( module.getClassLoader ( ) , lookupService ( module , org.ovirt.engine.api.extensions.Extension.class , props.getProperty ( Base.ConfigKeys.BINDINGS_JBOSSMODULE_CLASS ) ) . newInstance ( ) ) ; }
Source:
public void testSetStatusForRequiredNetworkAbsentOnHost ( ) { networkCluster.setStatus ( NetworkStatus.OPERATIONAL ) ; testSetStatusForRequiredNetwork ( ( "not" + ( org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelperTest.NETWORK_NAME ) ) ) ; org.mockito.Mockito.verify ( networkClusterDao ) . updateStatus ( org.mockito.ArgumentMatchers.same ( networkCluster ) ) ; org.junit.Assert.assertThat ( networkCluster.getStatus ( ) , org.hamcrest.Matchers.is ( NetworkStatus.NON_OPERATIONAL ) ) ; }

Target:
public void testSetStatusForRequiredNetworkAbsentOnHost ( ) { networkCluster.setStatus ( NetworkStatus.OPERATIONAL ) ; testSetStatusForRequiredNetwork ( createNetwork ( org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelperTest.NETWORK_ID1 , org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelperTest.NETWORK_NAME1 ) , org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelperTest.NETWORK_NAME2 ) ; org.mockito.Mockito.verify ( networkClusterDao ) . updateStatus ( org.mockito.ArgumentMatchers.same ( networkCluster ) ) ; org.junit.Assert.assertThat ( networkCluster.getStatus ( ) , org.hamcrest.Matchers.is ( NetworkStatus.NON_OPERATIONAL ) ) ; }
Source:
public void verifyListOfRunningVmsIsSameWithFailureOnGetVmStats ( ) { prepareForRefreshVmStatsCall ( ) ; mockGetVmStatsCommand ( false ) ; updater.fetchRunningVms ( ) ; java.util.List < org.ovirt.engine.core.compat.Guid > staleRunningVms = updater.checkVmsStatusChanged ( ) ; org.junit.Assert.assertFalse ( updater.getRunningVms ( ) . containsKey ( org.ovirt.engine.core.vdsbroker.VdsUpdateRunTimeInfoTest.VM_1 ) ) ; org.junit.Assert.assertTrue ( staleRunningVms.contains ( org.ovirt.engine.core.vdsbroker.VdsUpdateRunTimeInfoTest.VM_1 ) ) ; }

Target:
public void verifyListOfRunningVmsIsSameWithFailureOnGetVmStats ( ) { prepareForRefreshVmStatsCall ( ) ; mockGetVmStatsCommand ( false ) ; updater.fetchRunningVms ( ) ; java.util.List < org.ovirt.engine.core.compat.Guid > staleRunningVms = updater.checkVmsStatusChanged ( ) ; org.junit.Assert.assertFalse ( updater.getRunningVms ( ) . containsKey ( org.ovirt.engine.core.vdsbroker.HostMonitoringTest.VM_1 ) ) ; org.junit.Assert.assertTrue ( staleRunningVms.contains ( org.ovirt.engine.core.vdsbroker.HostMonitoringTest.VM_1 ) ) ; }
Source:
public void testGetIncludeStatistics ( ) throws java.lang.Exception { 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 ( ) ; assertTrue ( vm.isSetStatistics ( ) ) ; verifyModel ( vm , 0 ) ; } finally { accepts.clear ( ) ; } }

Target:
public void testGetIncludeStatistics ( ) throws java.lang.Exception { 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 ( ) ; } }
Source:
protected boolean setAndValidateCpuProfile ( ) { if ( ( isInstanceType ( ) ) || ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.isBlankTemplate ( ) ) ) { return true ; } return validate ( org.ovirt.engine.core.bll.profiles.CpuProfileHelper.setAndValidateCpuProfile ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVmTemplate ( ) , org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVdsGroup ( ) . getCompatibilityVersion ( ) ) ) ; }

Target:
protected boolean setAndValidateCpuProfile ( ) { if ( ( isInstanceType ( ) ) || ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.isBlankTemplate ( ) ) ) { return true ; } return validate ( org.ovirt.engine.core.bll.profiles.CpuProfileHelper.setAndValidateCpuProfile ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVmTemplate ( ) , org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVdsGroup ( ) . getCompatibilityVersion ( ) , org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getUserId ( ) ) ) ; }
Source:
public static java.lang.Long determineTotalImageInitialSize ( org.ovirt.engine.core.common.businessentities.storage.DiskImage sourceImage , org.ovirt.engine.core.common.businessentities.storage.VolumeFormat destFormat , org.ovirt.engine.core.compat.Guid dstDomain ) { if ( org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.isInitialSizeSupportedForFormat ( destFormat , dstDomain ) ) { double totalSizeForClonedDisk = org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.getTotalActualSizeOfDisk ( sourceImage , org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainDao ( ) . get ( dstDomain ) . getStorageStaticData ( ) ) ; return org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.computeCowImageNeededSize ( sourceImage.getVolumeFormat ( ) , java.lang.Double.valueOf ( totalSizeForClonedDisk ) . longValue ( ) ) ; } return null ; }

Target:
public static java.lang.Long determineTotalImageInitialSize ( org.ovirt.engine.core.common.businessentities.storage.DiskImage sourceImage , org.ovirt.engine.core.common.businessentities.storage.VolumeFormat destFormat , org.ovirt.engine.core.compat.Guid srcDomain , org.ovirt.engine.core.compat.Guid dstDomain ) { if ( org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.isInitialSizeSupportedForFormat ( destFormat , dstDomain ) ) { double totalSizeForClonedDisk = org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.getTotalActualSizeOfDisk ( sourceImage , org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainDao ( ) . get ( srcDomain ) . getStorageStaticData ( ) ) ; return org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.computeCowImageNeededSize ( sourceImage.getVolumeFormat ( ) , java.lang.Double.valueOf ( totalSizeForClonedDisk ) . longValue ( ) ) ; } return null ; }
Source:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" ) ; storageDevice2.setDevType ( "SDA" ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Arrays.asList ( storageDevice1 , storageDevice2 ) , getStorageDevice ( "sdb" ) , org.ovirt.engine.core.common.businessentities.CacheModeType.writethrough , 10 ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" ) ; storageDevice2.setDevType ( "SDA" ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Arrays.asList ( storageDevice1 , storageDevice2 ) , getStorageDevice ( "sdb" ) , org.ovirt.engine.core.common.businessentities.CacheModeType.writethrough , 10 ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.jupiter.api.Assertions.assertFalse ( cmd.validate ( ) ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.LdapGroup getAdGroup ( int index ) { org.ovirt.engine.core.common.businessentities.LdapGroup adGroup = new org.ovirt.engine.core.common.businessentities.LdapGroup ( ) ; adGroup.setid ( GUIDS [ index ] ) ; adGroup.setname ( NAMES [ index ] ) ; adGroup.setdomain ( org.ovirt.engine.api.restapi.resource.DOMAIN ) ; return adGroup ; }

Target:
protected org.ovirt.engine.core.common.businessentities.DbGroup getEntity ( int index ) { org.ovirt.engine.core.common.businessentities.DbGroup entity = new org.ovirt.engine.core.common.businessentities.DbGroup ( ) ; entity.setId ( GUIDS [ index ] ) ; entity.setName ( org.ovirt.engine.api.restapi.resource.BackendGroupsResourceTest.GROUP_NAMES [ index ] ) ; entity.setDomain ( org.ovirt.engine.api.restapi.resource.DOMAIN ) ; entity.setExternalId ( new org.ovirt.engine.core.common.utils.ExternalId ( GUIDS [ index ] . toByteArray ( ) ) ) ; return entity ; }