auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void initFrontend ( ) { org.ovirt.engine.ui.frontend.Frontend.setEventsHandler ( frontendEventsHandler ) ; org.ovirt.engine.ui.frontend.Frontend.getFrontendFailureEvent ( ) . addListener ( frontendFailureEventListener ) ; org.ovirt.engine.ui.frontend.Frontend.getFrontendNotLoggedInEvent ( ) . 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 ) { user.logout ( ) ; } } ) ; org.ovirt.engine.ui.frontend.Frontend.setFilterQueries ( filterFrontendQueries ( ) ) ; org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . bind ( new org.ovirt.engine.core.searchbackend.OsValueAutoCompleter ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getOsUniqueOsNames ( ) ) ) ; }

Target:
protected void initFrontend ( ) { org.ovirt.engine.ui.frontend.Frontend.setEventsHandler ( frontendEventsHandler ) ; org.ovirt.engine.ui.frontend.Frontend.getFrontendFailureEvent ( ) . addListener ( frontendFailureEventListener ) ; org.ovirt.engine.ui.frontend.Frontend.getFrontendNotLoggedInEvent ( ) . 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 ) { user.logout ( ) ; } } ) ; org.ovirt.engine.ui.frontend.Frontend.setFilterQueries ( filterFrontendQueries ( ) ) ; }
Source:
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 ( ) ; org.ovirt.engine.api.restapi.resource.AbstractBackendNicsResourceTest.verifyModelSpecific ( nic , 1 ) ; verifyLinks ( nic ) ; }

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 onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > pools = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > ) ( returnValue ) ) ; org.ovirt.engine.core.common.businessentities.storage_pool pool = pools.get ( 0 ) ; if ( pool != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetStorageDomainList ( ( ( org.ovirt.engine.ui.frontend.AsyncQuery ) ( model ) ) , pool.getId ( ) ) ; } }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > pools = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( returnValue ) ) ; org.ovirt.engine.core.common.businessentities.StoragePool pool = pools.get ( 0 ) ; if ( pool != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetStorageDomainList ( ( ( org.ovirt.engine.ui.frontend.AsyncQuery ) ( model ) ) , pool.getId ( ) ) ; } }
Source:
public void run ( ) { for ( org.ovirt.engine.core.compat.Guid vdsId : getRunVdssList ( ) ) { if ( ! ( getCurrentVdsId ( ) . equals ( vdsId ) ) ) { org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.FailedToRunVm , new org.ovirt.engine.core.common.vdscommands.FailedToRunVmVDSCommandParameters ( vdsId ) ) ; } } }

Target:
public void run ( ) { for ( org.ovirt.engine.core.compat.Guid vdsId : getRunVdssList ( ) ) { if ( ! ( vdsId.equals ( getCurrentVdsId ( ) ) ) ) { org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.FailedToRunVm , new org.ovirt.engine.core.common.vdscommands.FailedToRunVmVDSCommandParameters ( vdsId ) ) ; } } }
Source:
private java.util.Queue < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > getEventQueue ( org.ovirt.engine.core.compat.Guid storagePoolId ) { java.util.Queue < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > queue = org.ovirt.engine.core.bll.eventqueue.EventQueueMonitor.poolsEventsMap.get ( storagePoolId ) ; if ( queue == null ) { queue = new java.util.LinkedList < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > ( ) ; org.ovirt.engine.core.bll.eventqueue.EventQueueMonitor.poolsEventsMap.put ( storagePoolId , queue ) ; } return queue ; }

Target:
private java.util.LinkedList < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > getEventQueue ( org.ovirt.engine.core.compat.Guid storagePoolId ) { java.util.LinkedList < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > queue = org.ovirt.engine.core.bll.eventqueue.EventQueueMonitor.poolsEventsMap.get ( storagePoolId ) ; if ( queue == null ) { queue = new java.util.LinkedList < org.ovirt.engine.core.common.utils.Pair < org.ovirt.engine.core.common.eventqueue.Event , java.util.concurrent.FutureTask < org.ovirt.engine.core.common.eventqueue.EventResult > > > ( ) ; org.ovirt.engine.core.bll.eventqueue.EventQueueMonitor.poolsEventsMap.put ( storagePoolId , queue ) ; } return queue ; }
Source:
private void prepareCommand ( ) { parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( ) ; parameters.setVdsId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.connection.RemoveStorageServerConnectionCommand ( parameters ) ) ; org.mockito.Mockito.doReturn ( lunDao ) . when ( command ) . getLunDao ( ) ; org.mockito.Mockito.doReturn ( storageServerConnectionDao ) . when ( command ) . getStorageServerConnectionDao ( ) ; }

Target:
private void prepareCommand ( ) { parameters = new org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase ( ) ; parameters.setVdsId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.connection.RemoveStorageServerConnectionCommand ( parameters , null ) ) ; org.mockito.Mockito.doReturn ( lunDao ) . when ( command ) . getLunDao ( ) ; org.mockito.Mockito.doReturn ( storageServerConnectionDao ) . when ( command ) . getStorageServerConnectionDao ( ) ; }
Source:
public void testFirstMatch ( ) { java.util.List < java.lang.String > source = java.util.Arrays.asList ( "zero" , "one" , "two " , "three" ) ; org.junit.Assert.assertEquals ( "one" , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , "one" , "two" ) ) ; org.junit.Assert.assertEquals ( "one" , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , "two" , "one" ) ) ; org.junit.Assert.assertEquals ( null , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , null ) ) ; }

Target:
public void testFirstMatch ( ) { java.util.List < java.lang.String > source = java.util.Arrays.asList ( "zero" , "one" , "two " , "three" ) ; org.junit.Assert.assertEquals ( "one" , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , "one" , "two" ) ) ; org.junit.Assert.assertEquals ( "one" , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , "two" , "one" ) ) ; org.junit.Assert.assertEquals ( null , org.ovirt.engine.core.common.utils.ListUtils.firstMatch ( source , ( ( java.lang.String [ ] ) ( null ) ) ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > disks = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > diskList = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ; diskList.addAll ( disks ) ; java.util.Collections.sort ( diskList , new org.ovirt.engine.ui.uicommonweb.Linq.DiskByAliasComparer ( ) ) ; org.ovirt.engine.ui.uicommonweb.models.SearchableListModel searchableListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.SearchableListModel ) ( model ) ) ; searchableListModel.setItems ( diskList ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > disks = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ) ) ; java.util.Collections.sort ( disks , new org.ovirt.engine.ui.uicommonweb.Linq.DiskByAliasComparer ( ) ) ; org.ovirt.engine.ui.uicommonweb.models.SearchableListModel searchableListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.SearchableListModel ) ( model ) ) ; searchableListModel.setItems ( disks ) ; }
Source:
private void endVmTemplateRelatedOps ( ) { if ( ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplate ( ) ) != null ) { incrementDbGeneration ( ) ; org.ovirt.engine.core.bll.VmTemplateHandler.UnLockVmTemplate ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplateId ( ) ) ; org.ovirt.engine.core.bll.utils.VmDeviceUtils.setVmDevices ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplate ( ) ) ; } else { org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.setCommandShouldBeLogged ( false ) ; log.warn ( "MoveOrCopyTemplateCommand::EndMoveOrCopyCommand: VmTemplate is null, not performing full EndAction" ) ; } }

Target:
private void endVmTemplateRelatedOps ( ) { if ( ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplate ( ) ) != null ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.setVmDevices ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplate ( ) ) ; incrementDbGeneration ( ) ; org.ovirt.engine.core.bll.VmTemplateHandler.UnLockVmTemplate ( org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.getVmTemplateId ( ) ) ; } else { org.ovirt.engine.core.bll.MoveOrCopyTemplateCommand.setCommandShouldBeLogged ( false ) ; log.warn ( "MoveOrCopyTemplateCommand::EndMoveOrCopyCommand: VmTemplate is null, not performing full EndAction" ) ; } }
Source:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > storageDomainList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( returnValue ) ) ; if ( ( storageDomainList.size ( ) ) != 0 ) { model.getStorageTypeList ( ) . setChangeProhibitionReason ( "Cannot change Repository type with Storage Domains attached to it" ) ; model.getStorageTypeList ( ) . setIsChangable ( false ) ; } }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > storageDomainList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( returnValue ) ) ; if ( ( storageDomainList.size ( ) ) != 0 ) { model.getStorageTypeList ( ) . setChangeProhibitionReason ( "Cannot change Repository type with Storage Domains attached to it" ) ; model.getStorageTypeList ( ) . setIsChangable ( false ) ; } }
Source:
public void testExtractVariableDeclarationsForStaticMsgs ( ) { org.ovirt.engine.core.common.action.VdcActionParametersBase parameterMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.action.VdcActionParametersBase.class ) ; org.ovirt.engine.core.bll.CommandBase < org.ovirt.engine.core.common.action.VdcActionParametersBase > command = new org.ovirt.engine.core.bll.CommandBaseTest.CommandBaseDummy ( parameterMock ) ; java.util.List < java.lang.String > msgs = java.util.Arrays.asList ( "ACTION_TYPE_FAILED_TEMPLATE_IS_USED_FOR_CREATE_VM" , "IRS_FAILED_RETRIEVING_SNAPSHOT_INFO" ) ; org.junit.Assert.assertTrue ( "extractVariableDeclarations didn't return the same static messages" , org.apache.commons.collections.CollectionUtils.isEqualCollection ( msgs , command.extractVariableDeclarations ( msgs ) ) ) ; }

Target:
public void testExtractVariableDeclarationsForStaticMsgs ( ) { java.util.List < java.lang.String > msgs = java.util.Arrays.asList ( "ACTION_TYPE_FAILED_TEMPLATE_IS_USED_FOR_CREATE_VM" , "IRS_FAILED_RETRIEVING_SNAPSHOT_INFO" ) ; org.junit.Assert.assertTrue ( "extractVariableDeclarations didn't return the same static messages" , org.apache.commons.collections.CollectionUtils.isEqualCollection ( msgs , command.extractVariableDeclarations ( msgs ) ) ) ; }
Source:
public void validateSucceedsWithStopActionTypeAndClusterIdAndServerId ( ) { cmd.getParameters ( ) . setActionType ( GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP ) ; cmd.getParameters ( ) . setClusterId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd.getParameters ( ) . setServerId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd.setClusterId ( cmd.getParameters ( ) . getClusterId ( ) ) ; cmd.setVdsId ( cmd.getParameters ( ) . getServerId ( ) ) ; prepareMocks ( cmd ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void validateSucceedsWithStopActionTypeAndClusterIdAndServerId ( ) { cmd.getParameters ( ) . setActionType ( GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP ) ; cmd.getParameters ( ) . setClusterId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd.getParameters ( ) . setServerId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; cmd.setClusterId ( cmd.getParameters ( ) . getClusterId ( ) ) ; cmd.setVdsId ( cmd.getParameters ( ) . getServerId ( ) ) ; prepareMocks ( ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
private void updateDcLabels ( ) { startProgress ( null ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getNetworkLabelsByDataCenterId ( getSelectedDc ( ) . getId ( ) , new org.ovirt.engine.ui.frontend.AsyncQuery ( new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { dcLabels = ( ( java.util.Collection < java.lang.String > ) ( returnValue ) ) ; stopProgress ( ) ; onExportChanged ( ) ; } } ) ) ; }

Target:
private void updateDcLabels ( ) { startProgress ( null ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getNetworkLabelsByDataCenterId ( getSelectedDc ( ) . getId ( ) , new org.ovirt.engine.ui.frontend.AsyncQuery ( new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { dcLabels = ( ( java.util.Collection < java.lang.String > ) ( returnValue ) ) ; stopProgress ( ) ; onExportChanged ( ) ; } } ) ) ; }
Source:
public void testRefreshStatus ( ) { org.mockito.Mockito.doReturn ( getSessionDetailsVDSReturnVal ( true ) ) . when ( syncJob ) . runVdsCommand ( org.mockito.ArgumentMatchers.eq ( VDSCommandType.GetGlusterVolumeGeoRepSessionStatus ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters.class ) ) ; syncJob.refreshGeoRepSessionStatus ( ) ; org.mockito.Mockito.verify ( geoRepDao , org.mockito.Mockito.times ( 2 ) ) . saveOrUpdateDetailsInBatch ( org.mockito.ArgumentMatchers.anyList ( ) ) ; }

Target:
public void testRefreshStatus ( ) { org.mockito.Mockito.doReturn ( getSessionDetailsVDSReturnVal ( true ) ) . when ( syncJob ) . runVdsCommand ( org.mockito.ArgumentMatchers.eq ( VDSCommandType.GetGlusterVolumeGeoRepSessionStatus ) , org.mockito.ArgumentMatchers.any ( ) ) ; syncJob.refreshGeoRepSessionStatus ( ) ; org.mockito.Mockito.verify ( geoRepDao , org.mockito.Mockito.times ( 2 ) ) . saveOrUpdateDetailsInBatch ( org.mockito.ArgumentMatchers.anyList ( ) ) ; }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > getFreeBonds ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > freeBonds = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ( ) ; for ( org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond : allBonds ) { if ( ! ( nicMap.containsKey ( bond.getName ( ) ) ) ) { freeBonds.add ( bond ) ; } } return freeBonds ; }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > getFreeBonds ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > freeBonds = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface bond : allBonds ) { if ( ! ( nicMap.containsKey ( bond.getName ( ) ) ) ) { freeBonds.add ( bond ) ; } } return freeBonds ; }
Source:
public static void getVnicProfilesByDcId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dcId ) { if ( ( aQuery.converterCallback ) == null ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VnicProfileView > ( ) ; } return source ; } } ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVnicProfilesByDataCenterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dcId ) , aQuery ) ; }

Target:
public void getVnicProfilesByDcId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dcId ) { if ( ( aQuery.converterCallback ) == null ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VnicProfileView > ( ) ; } return source ; } } ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVnicProfilesByDataCenterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dcId ) , aQuery ) ; }
Source:
public void init ( ) { super . init ( ) ; org.ovirt.engine.api.restapi.utils.OsTypeMockUtils.mockOsTypes ( ) ; osRepository = control.createMock ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) ; org.ovirt.engine.core.common.utils.SimpleDependencyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; org.ovirt.engine.core.common.config.Config.setConfigUtils ( new org.ovirt.engine.api.restapi.resource.VmMapperMockConfigUtils ( ) ) ; }

Target:
public void init ( ) { super . init ( ) ; org.ovirt.engine.api.restapi.utils.OsTypeMockUtils.mockOsTypes ( ) ; osRepository = control.createMock ( org.ovirt.engine.core.common.osinfo.OsRepository.class ) ; org.ovirt.engine.core.common.utils.SimpleDependencyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; }
Source:
public javax.ws.rs.core.Response remove ( java.lang.String id , org.ovirt.engine.api.model.Action action ) { getEntity ( id ) ; if ( ( action.isSetDetach ( ) ) && ( action.isDetach ( ) ) ) { return performAction ( VdcActionType.DetachDiskFromVm , new org.ovirt.engine.core.common.action.AttachDettachVmDiskParameters ( parentId , org.ovirt.engine.core.compat.Guid.createGuidFromStringDefaultEmpty ( id ) , true ) ) ; } else { return remove ( id ) ; } }

Target:
public javax.ws.rs.core.Response remove ( java.lang.String id , org.ovirt.engine.api.model.Action action ) { getEntity ( id ) ; if ( ( action.isSetDetach ( ) ) && ( action.isDetach ( ) ) ) { return performAction ( VdcActionType.DetachDiskFromVm , new org.ovirt.engine.core.common.action.AttachDettachVmDiskParameters ( parentId , org.ovirt.engine.core.compat.Guid.createGuidFromStringDefaultEmpty ( id ) ) ) ; } else { return remove ( id ) ; } }
Source:
private java.lang.String getIpv6Address ( org.ovirt.engine.core.common.vdscommands.HostNetwork attachment ) { final java.lang.String ipv6Address = attachment.getIpv6Address ( ) ; final java.lang.Integer ipv6Prefix = attachment.getIpv6Prefix ( ) ; if ( ( ipv6Address.contains ( "/" ) ) || ( ipv6Prefix == null ) ) { return ipv6Address ; } else { return java.lang.String.format ( "%s/%d" , ipv6Address , ipv6Prefix ) ; } }

Target:
private java.lang.String getIpv6Address ( org.ovirt.engine.core.common.vdscommands.HostNetwork attachment ) { final java.lang.String ipv6Address = attachment.getIpv6Address ( ) ; final java.lang.Integer ipv6Prefix = attachment.getIpv6Prefix ( ) ; return ipv6Prefix == null ? ipv6Address : java.lang.String.format ( "%s/%d" , ipv6Address , ipv6Prefix ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.Collection < org.ovirt.engine.core.common.businessentities.network.HostNetworkQos > qos = ( ( java.util.Collection < org.ovirt.engine.core.common.businessentities.network.HostNetworkQos > ) ( returnValue ) ) ; getQos ( ) . setItems ( qos ) ; getQos ( ) . setSelectedItem ( org.ovirt.engine.ui.uicommonweb.Linq.findHostNetworkQosById ( qos , getNetwork ( ) . getQosId ( ) ) ) ; }

Target:
public void onSuccess ( java.util.List < org.ovirt.engine.core.common.businessentities.network.HostNetworkQos > qos ) { getQos ( ) . setItems ( qos ) ; getQos ( ) . setSelectedItem ( org.ovirt.engine.ui.uicommonweb.Linq.findHostNetworkQosById ( qos , getNetwork ( ) . getQosId ( ) ) ) ; }
Source:
protected org.ovirt.engine.core.common.action.VdcReturnValueBase removeVmImages ( java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > images ) { org.ovirt.engine.core.common.action.VdcReturnValueBase vdcRetValue = org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.RemoveAllVmImages , buildRemoveAllVmImagesParameters ( images ) , org.ovirt.engine.core.bll.job.ExecutionHandler.createDefaultContexForTasks ( getExecutionContext ( ) ) ) ; if ( vdcRetValue.getSucceeded ( ) ) { getReturnValue ( ) . getVdsmTaskIdList ( ) . addAll ( vdcRetValue.getInternalVdsmTaskIdList ( ) ) ; } return vdcRetValue ; }

Target:
protected org.ovirt.engine.core.common.action.VdcReturnValueBase removeVmImages ( java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > images ) { org.ovirt.engine.core.common.action.VdcReturnValueBase vdcRetValue = runInternalAction ( VdcActionType.RemoveAllVmImages , buildRemoveAllVmImagesParameters ( images ) , org.ovirt.engine.core.bll.job.ExecutionHandler.createDefaultContexForTasks ( getExecutionContext ( ) ) ) ; if ( vdcRetValue.getSucceeded ( ) ) { getReturnValue ( ) . getVdsmTaskIdList ( ) . addAll ( vdcRetValue.getInternalVdsmTaskIdList ( ) ) ; } return vdcRetValue ; }
Source:
public void testGetEntityNameByIdAndTypeForDataCenter ( ) { org.ovirt.engine.core.common.businessentities.StoragePool storagePool = dbFacade.getStoragePoolDao ( ) . get ( org.ovirt.engine.core.dao.DbFacadeDAOTest.STORAGE_POOL_ID ) ; org.junit.Assert.assertNotNull ( storagePool ) ; java.lang.String name = storagePool.getname ( ) ; org.junit.Assert.assertTrue ( name.equals ( dbFacade.getEntityNameByIdAndType ( org.ovirt.engine.core.dao.DbFacadeDAOTest.STORAGE_POOL_ID , VdcObjectType.StoragePool ) ) ) ; }

Target:
public void testGetEntityNameByIdAndTypeForDataCenter ( ) { org.ovirt.engine.core.common.businessentities.StoragePool storagePool = dbFacade.getStoragePoolDao ( ) . get ( org.ovirt.engine.core.dao.DbFacadeDAOTest.STORAGE_POOL_ID ) ; org.junit.Assert.assertNotNull ( storagePool ) ; java.lang.String name = storagePool.getName ( ) ; org.junit.Assert.assertTrue ( name.equals ( dbFacade.getEntityNameByIdAndType ( org.ovirt.engine.core.dao.DbFacadeDAOTest.STORAGE_POOL_ID , VdcObjectType.StoragePool ) ) ) ; }
Source:
public boolean isGraphicsAndDisplaySupported ( int osId , org.ovirt.engine.core.compat.Version version , java.util.Collection < org.ovirt.engine.core.common.businessentities.GraphicsType > graphics , org.ovirt.engine.core.common.businessentities.DisplayType displayType ) { for ( org.ovirt.engine.core.common.businessentities.GraphicsType graphicType : graphics ) { if ( ! ( osRepository.getGraphicsAndDisplays ( ) . get ( osId ) . get ( version ) . contains ( new org.ovirt.engine.core.common.utils.Pair ( graphicType , displayType ) ) ) ) { return false ; } } return true ; }

Target:
public boolean isGraphicsAndDisplaySupported ( int osId , org.ovirt.engine.core.compat.Version version , java.util.Collection < org.ovirt.engine.core.common.businessentities.GraphicsType > graphics , org.ovirt.engine.core.common.businessentities.DisplayType displayType ) { for ( org.ovirt.engine.core.common.businessentities.GraphicsType graphicType : graphics ) { if ( ! ( osRepository.getGraphicsAndDisplays ( osId , version ) . contains ( new org.ovirt.engine.core.common.utils.Pair ( graphicType , displayType ) ) ) ) { return false ; } } return true ; }
Source:
public void zeroDiskSize ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 0 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = 5 ; settings.spaceThresholdPct = 10 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertFalse ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isWithinThresholds ( domain ) ) ; }

Target:
public void zeroDiskSize ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 0 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = 5 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertFalse ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isWithinThresholds ( domain ) ) ; }
Source:
protected java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > getStorageDomainList ( int availableDiskSizeFirstDomain , int availableDiskSizeSecondDomain ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > storageDomainList = new java.util.ArrayList < > ( ) ; storageDomainList.add ( mockFirstStorageDomain ( availableDiskSizeFirstDomain ) ) ; storageDomainList.add ( mockSecondStorageDomain ( availableDiskSizeSecondDomain ) ) ; return storageDomainList ; }

Target:
protected java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > getStorageDomainList ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > storageDomainList = new java.util.ArrayList < > ( ) ; storageDomainList.add ( mockFirstStorageDomain ( ) ) ; storageDomainList.add ( mockSecondStorageDomain ( ) ) ; return storageDomainList ; }
Source:
public void OnSuccess ( java.lang.Object model , java.lang.Object result ) { org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalBasicListModel userPortalBasicListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalBasicListModel ) ( model ) ) ; if ( result != null ) { org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( result ) ) . getReturnValue ( ) ) ) ; if ( vm != null ) { userPortalBasicListModel.UpdateDetails ( vm ) ; } } }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object result ) { org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalBasicListModel userPortalBasicListModel = ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalBasicListModel ) ( model ) ) ; if ( result != null ) { org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( result ) ) . getReturnValue ( ) ) ) ; if ( vm != null ) { userPortalBasicListModel.UpdateDetails ( vm ) ; } } }
Source:
private org.ovirt.engine.core.common.businessentities.storage.DiskImage createDiskImage ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage disk = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; disk.setId ( diskImageGuid ) ; disk.setSize ( 100000L ) ; disk.setDiskInterface ( DiskInterface.VirtIO ) ; disk.setStorageIds ( new java.util.ArrayList ( java.util.Collections.singleton ( sdId ) ) ) ; disk.setStoragePoolId ( spId ) ; disk.setDescription ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; return disk ; }

Target:
private org.ovirt.engine.core.common.businessentities.storage.DiskImage createDiskImage ( ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage disk = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; disk.setId ( diskImageGuid ) ; disk.setSize ( 100000L ) ; disk.setStorageIds ( new java.util.ArrayList ( java.util.Collections.singleton ( sdId ) ) ) ; disk.setStoragePoolId ( spId ) ; disk.setDescription ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ) ; return disk ; }
Source:
protected boolean shouldPerformOvfUpdate ( ) { return ( ( ( ! ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getParameters ( ) . isInactive ( ) ) ) && ( ovfOnAnyDomainSupported ( ) ) ) && ( ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getStorageDomain ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) ) && ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getStorageDomain ( ) . getStorageDomainType ( ) . isDataDomain ( ) ) ; }

Target:
protected boolean shouldPerformOvfUpdate ( ) { return ( ( ! ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getParameters ( ) . isInactive ( ) ) ) && ( ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getStorageDomain ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) ) && ( org.ovirt.engine.core.bll.storage.DeactivateStorageDomainWithOvfUpdateCommand.getStorageDomain ( ) . getStorageDomainType ( ) . isDataDomain ( ) ) ; }
Source:
void bindConfiguration ( ) { bindConstant ( ) . annotatedWith ( org.ovirt.engine.ui.common.section.DefaultMainSectionPlace.class ) . to ( WebAdminApplicationPlaces.DEFAULT_MAIN_SECTION_PLACE ) ; bindConstant ( ) . annotatedWith ( org.ovirt.engine.ui.common.system.ClientStorageKeyPrefix.class ) . to ( org.ovirt.engine.ui.webadmin.gin.SystemModule.CLIENT_STORAGE_KEY_PREFIX ) ; bindResourceConfiguration ( org.ovirt.engine.ui.webadmin.ApplicationConstants.class , org.ovirt.engine.ui.webadmin.ApplicationMessages.class , org.ovirt.engine.ui.webadmin.ApplicationResources.class , org.ovirt.engine.ui.webadmin.ApplicationTemplates.class , org.ovirt.engine.ui.webadmin.ApplicationDynamicMessages.class ) ; }

Target:
void bindConfiguration ( ) { bindConstant ( ) . annotatedWith ( org.ovirt.engine.ui.common.section.DefaultMainSectionPlace.class ) . to ( WebAdminApplicationPlaces.DEFAULT_MAIN_SECTION_PLACE ) ; bindResourceConfiguration ( org.ovirt.engine.ui.webadmin.ApplicationConstants.class , org.ovirt.engine.ui.webadmin.ApplicationMessages.class , org.ovirt.engine.ui.webadmin.ApplicationResources.class , org.ovirt.engine.ui.webadmin.ApplicationTemplates.class , org.ovirt.engine.ui.webadmin.ApplicationDynamicMessages.class ) ; }
Source:
public void compare ( ) { org.junit.Assert.assertTrue ( ( ( Version.v3_6.compareTo ( Version.v4_0 ) ) == ( - 1 ) ) ) ; org.junit.Assert.assertTrue ( ( ( Version.v4_0.compareTo ( Version.v3_6 ) ) == 1 ) ) ; org.junit.Assert.assertTrue ( ( ( Version.v3_6.compareTo ( new org.ovirt.engine.core.compat.Version ( "3.6" ) ) ) == 0 ) ) ; }

Target:
public void compare ( ) { org.junit.Assert.assertTrue ( ( ( Version.v3_6.compareTo ( Version.v4_0 ) ) < 0 ) ) ; org.junit.Assert.assertTrue ( ( ( Version.v4_0.compareTo ( Version.v3_6 ) ) > 0 ) ) ; org.junit.Assert.assertTrue ( ( ( Version.v3_6.compareTo ( new org.ovirt.engine.core.compat.Version ( "3.6" ) ) ) == 0 ) ) ; }
Source:
static org.ovirt.engine.api.model.NIC getModel ( int index ) { org.ovirt.engine.api.model.NIC model = new org.ovirt.engine.api.model.NIC ( ) ; model.setName ( NAMES [ index ] ) ; model.setInterface ( NicInterface.RTL8139_VIRTIO.value ( ) ) ; model.setNetwork ( new org.ovirt.engine.api.model.Network ( ) ) ; model.getNetwork ( ) . setId ( GUIDS [ 0 ] . toString ( ) ) ; return model ; }

Target:
static org.ovirt.engine.api.model.NIC getModel ( int index ) { org.ovirt.engine.api.model.NIC model = new org.ovirt.engine.api.model.NIC ( ) ; model.setName ( NAMES [ index ] ) ; model.setInterface ( NicInterface.RTL8139_VIRTIO.value ( ) ) ; return model ; }
Source:
public void hostProviderDoesNotExist ( ) { org.mockito.Mockito.when ( host.getHostProviderId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( providerDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( null ) ; org.mockito.Mockito.when ( dbFacade.getProviderDao ( ) ) . thenReturn ( providerDao ) ; validator = new org.ovirt.engine.core.bll.validator.UpdateHostValidator ( dbFacade , oldHost , host , false , hostedEngineHelper ) ; org.junit.Assert.assertThat ( validator.hostProviderExists ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST ) ) ; }

Target:
public void hostProviderDoesNotExist ( ) { org.mockito.Mockito.when ( host.getHostProviderId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( dbFacade.getProviderDao ( ) ) . thenReturn ( providerDao ) ; validator = new org.ovirt.engine.core.bll.validator.UpdateHostValidator ( dbFacade , oldHost , host , false , hostedEngineHelper ) ; org.junit.Assert.assertThat ( validator.hostProviderExists ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST ) ) ; }
Source:
public java.lang.Void runInTransaction ( ) { getCompensationContext ( ) . snapshotEntityStatus ( diskImage.getImage ( ) , imgStatus ) ; getCompensationContext ( ) . stateChanged ( ) ; diskImage.setImageStatus ( ImageStatus.LOCKED ) ; org.ovirt.engine.core.bll.ImagesHandler.updateImageStatus ( diskImage.getImageId ( ) , ImageStatus.LOCKED ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { getCompensationContext ( ) . snapshotEntityStatus ( diskImage.getImage ( ) ) ; getCompensationContext ( ) . stateChanged ( ) ; diskImage.setImageStatus ( ImageStatus.LOCKED ) ; org.ovirt.engine.core.bll.ImagesHandler.updateImageStatus ( diskImage.getImageId ( ) , ImageStatus.LOCKED ) ; return null ; }
Source:
public org.ovirt.engine.api.resource.StatisticsResource getStatisticsResource ( ) { org.ovirt.engine.api.restapi.resource.EntityIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.VdcQueryType.GetVdsByVdsId , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; org.ovirt.engine.api.restapi.resource.HostStatisticalQuery query = new org.ovirt.engine.api.restapi.resource.HostStatisticalQuery ( resolver , newModel ( id ) ) ; return inject ( new org.ovirt.engine.api.restapi.resource.BackendStatisticsResource < org.ovirt.engine.api.model.Host , org.ovirt.engine.core.common.businessentities.VDS > ( entityType , guid , query ) ) ; }

Target:
public org.ovirt.engine.api.resource.StatisticsResource getStatisticsResource ( ) { org.ovirt.engine.api.restapi.resource.EntityIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetVdsByVdsId , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; org.ovirt.engine.api.restapi.resource.HostStatisticalQuery query = new org.ovirt.engine.api.restapi.resource.HostStatisticalQuery ( resolver , newModel ( id ) ) ; return inject ( new org.ovirt.engine.api.restapi.resource.BackendStatisticsResource ( entityType , guid , query ) ) ; }
Source:
private void fillReportedConfigurations ( java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > networkNameToNicMap , org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.network.Network > networkMap , org.ovirt.engine.core.bll.network.host.QosDaoCache qosDaoCache , org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment ) { org.ovirt.engine.core.common.businessentities.network.Network network = networkMap.get ( networkAttachment.getNetworkId ( ) ) ; org.ovirt.engine.core.common.businessentities.network.HostNetworkQos networkQos = qosDaoCache.get ( network.getQosId ( ) ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = getNicToWhichIsNetworkAttached ( networkNameToNicMap , networkMap , networkAttachment ) ; if ( nic != null ) { org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations reportedConfigurations = createNetworkInSyncWithVdsNetworkInterface ( network , networkQos , nic ) . reportConfigurationsOnHost ( ) ; networkAttachment.setReportedConfigurations ( reportedConfigurations ) ; } }

Target:
private void fillReportedConfigurations ( java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > networkNameToNicMap , org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.network.Network > networkMap , org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment ) { org.ovirt.engine.core.common.businessentities.network.Network network = networkMap.get ( networkAttachment.getNetworkId ( ) ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = getNicToWhichIsNetworkAttached ( networkNameToNicMap , networkMap , networkAttachment ) ; if ( nic != null ) { org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations reportedConfigurations = createNetworkInSyncWithVdsNetworkInterface ( networkAttachment , nic , network ) . reportConfigurationsOnHost ( ) ; networkAttachment.setReportedConfigurations ( reportedConfigurations ) ; } }
Source:
public void testImportWithStorageDomainName ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ( "Storage: name=" + ( NAMES [ 2 ] ) ) , SearchType.StorageDomain , getStorageDomain ( 2 ) ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setName ( NAMES [ 2 ] ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setId ( GUIDS [ 1 ] . toString ( ) ) ; doTestImport ( storageDomain , cluster ) ; }

Target:
public void testImportWithStorageDomainName ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ( "Storage: name=" + ( NAMES [ 2 ] ) ) , SearchType.StorageDomain , getStorageDomain ( 2 ) ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setName ( NAMES [ 2 ] ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setId ( GUIDS [ 1 ] . toString ( ) ) ; doTestImport ( storageDomain , cluster , false ) ; }
Source:
public void testAddVersionNoBaseTemplateId ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; org.ovirt.engine.api.model.Template t = org.ovirt.engine.api.restapi.resource.BackendTemplatesResourceTest.getModel ( 2 ) ; t.getVersion ( ) . setBaseTemplate ( null ) ; try { collection.add ( t ) ; fail ( "Should have failed with 400 error due to a missing base template" ) ; } catch ( javax.ws.rs.WebApplicationException e ) { assertNotNull ( e.getResponse ( ) ) ; assertEquals ( 400 , e.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testAddVersionNoBaseTemplateId ( ) throws java.lang.Exception { 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 ) ; fail ( "Should have failed with 400 error due to a missing base template" ) ; } catch ( javax.ws.rs.WebApplicationException e ) { assertNotNull ( e.getResponse ( ) ) ; assertEquals ( 400 , e.getResponse ( ) . getStatus ( ) ) ; } }
Source:
private static java.lang.Double AssignDoubleValue ( java.util.Map < java.lang.String , java.lang.Object > input , java.lang.String name ) { java.lang.Double returnValue = null ; if ( input.containsKey ( name ) ) { java.lang.String stringValue = ( ( java.lang.String ) ( ( ( input.get ( name ) ) instanceof java.lang.String ) ? input.get ( name ) : null ) ) ; returnValue = ( stringValue == null ) ? null : java.lang.Double.parseDouble ( stringValue ) ; } return returnValue ; }

Target:
private static java.lang.Double AssignDoubleValue ( java.util.Map < java.lang.String , java.lang.Object > input , java.lang.String name ) { java.lang.Object value = input.get ( name ) ; if ( value instanceof java.lang.Double ) { return ( ( java.lang.Double ) ( value ) ) ; } else if ( value instanceof java.lang.String ) { return java.lang.Double.parseDouble ( ( ( java.lang.String ) ( value ) ) ) ; } return null ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { java.lang.Iterable < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > iVdcQueryableItems = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > items = new java.util.ArrayList < > ( ) ; java.util.Iterator < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > networkInterfacesIterator = iVdcQueryableItems.iterator ( ) ; while ( networkInterfacesIterator.hasNext ( ) ) { items.add ( ( ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface ) ( networkInterfacesIterator.next ( ) ) ) ) ; } updateItems ( items ) ; }

Target:
public void onSuccess ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > items = returnValue.getReturnValue ( ) ; updateItems ( items ) ; }
Source:
protected void executeVmCommand ( ) { try { vmHandler.updateDisksFromDb ( org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.getVm ( ) ) ; java.util.List < java.lang.String > diskPaths = prepareImages ( ) ; boolean succeeded = runAnsibleImportOvaPlaybook ( diskPaths ) ; teardownImages ( ) ; if ( ! succeeded ) { log.error ( "Failed to extract OVA file" ) ; setCommandStatus ( CommandStatus.FAILED ) ; } else { org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.setSucceeded ( true ) ; } } catch ( org.ovirt.engine.core.common.errors.EngineException e ) { log.error ( "Failed to extract OVA file" ) ; setCommandStatus ( CommandStatus.FAILED ) ; } }

Target:
protected void executeVmCommand ( ) { try { vmHandler.updateDisksFromDb ( org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.getVm ( ) ) ; java.util.List < java.lang.String > diskPaths = prepareImages ( ) ; boolean succeeded = runAnsibleImportOvaPlaybook ( diskPaths ) ; teardownImages ( ) ; if ( ! succeeded ) { log.error ( "Failed to extract OVA file" ) ; setCommandStatus ( CommandStatus.FAILED ) ; } else { org.ovirt.engine.core.bll.exportimport.ExtractOvaCommand.setSucceeded ( true ) ; } } catch ( org.ovirt.engine.core.common.errors.EngineException e ) { log.error ( "Failed to extract OVA file" , e ) ; setCommandStatus ( CommandStatus.FAILED ) ; } }
Source:
public void prepareMocks ( ) { org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( cmd ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getVdsStatic ( ) ) . when ( vdsStaticDao ) . get ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeCommandTest.serverId ) ; org.mockito.Mockito.doReturn ( getCluster ( true , Version.v4_1 ) ) . when ( clusterDao ) . get ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; }

Target:
public void prepareMocks ( ) { org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( cmd ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getVdsStatic ( ) ) . when ( vdsStaticDao ) . get ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeCommandTest.serverId ) ; org.mockito.Mockito.doReturn ( getCluster ( true , Version.v4_1 ) ) . when ( clusterDao ) . get ( org.mockito.ArgumentMatchers.any ( ) ) ; }
Source:
protected org.springframework.jdbc.core.namedparam.MapSqlParameterSource createFullParametersMapper ( T obj ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource map = createIdParameterMapper ( obj.getId ( ) ) . addValue ( "qos_type" , getQosType ( ) ) . addValue ( "name" , obj.getName ( ) ) . addValue ( "description" , obj.getDescription ( ) ) . addValue ( "storage_pool_id" , obj.getStoragePoolId ( ) ) ; return map ; }

Target:
protected org.springframework.jdbc.core.namedparam.MapSqlParameterSource createFullParametersMapper ( T obj ) { return createIdParameterMapper ( obj.getId ( ) ) . addValue ( "qos_type" , getQosType ( ) ) . addValue ( "name" , obj.getName ( ) ) . addValue ( "description" , obj.getDescription ( ) ) . addValue ( "storage_pool_id" , obj.getStoragePoolId ( ) ) ; }
Source:
public void testUpdateWhenAbortedTasks ( ) { org.mockito.Mockito.doReturn ( getTasks ( JobExecutionStatus.ABORTED ) ) . when ( provider ) . getTaskListForCluster ( org.ovirt.engine.core.bll.gluster.GlusterTasksSyncJobTest.CLUSTER_GUIDS [ 1 ] ) ; prepareMocks ( ) ; tasksSyncJob.updateGlusterAsyncTasks ( ) ; org.mockito.Mockito.verify ( taskUtils , org.mockito.Mockito.times ( 2 ) ) . updateSteps ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.anyList ( ) ) ; }

Target:
public void testUpdateWhenAbortedTasks ( ) { org.mockito.Mockito.doReturn ( getTasks ( JobExecutionStatus.ABORTED ) ) . when ( provider ) . getTaskListForCluster ( org.ovirt.engine.core.bll.gluster.GlusterTasksSyncJobTest.CLUSTER_GUIDS [ 1 ] ) ; prepareMocks ( ) ; tasksSyncJob.updateGlusterAsyncTasks ( ) ; org.mockito.Mockito.verify ( taskUtils , org.mockito.Mockito.times ( 2 ) ) . updateSteps ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ; }