auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public org.ovirt.engine.core.bll.ValidationResult isDomainExistAndActive ( ) { if ( ( storageDomain ) == null ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST ) ; } if ( ( storageDomain.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2 , java.lang.String.format ( "$%1$s %2$s" , "status" , storageDomain.getStatus ( ) . name ( ) ) ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult isDomainExistAndActive ( ) { org.ovirt.engine.core.bll.ValidationResult domainExistValidation = isDomainExist ( ) ; if ( ! ( ValidationResult.VALID.equals ( domainExistValidation ) ) ) { return domainExistValidation ; } if ( ( storageDomain.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.StorageDomainStatus.Active ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2 , java.lang.String.format ( "$%1$s %2$s" , "status" , storageDomain.getStatus ( ) . name ( ) ) ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
public void flushToPrivateModel ( ) { flushCheckBoxes ( ctrlAltDel , enableUsbAutoshare , openInFullScreen , useLocalDrives , wanEnabled , disableSmartcard ) ; if ( spiceRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.SPICE ) ; } else if ( remoteDesktopRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.RDP ) ; } else if ( vncRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.VNC ) ; } }

Target:
public void flushToPrivateModel ( ) { flushCheckBoxes ( ctrlAltDel , enableUsbAutoshare , openInFullScreen , enableSpiceProxy , useLocalDrives , wanEnabled , disableSmartcard ) ; if ( spiceRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.SPICE ) ; } else if ( remoteDesktopRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.RDP ) ; } else if ( vncRadioButton.asRadioButton ( ) . getValue ( ) ) { setSelectedProtocol ( ConsoleProtocol.VNC ) ; } }
Source:
public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ) ( source ) ) : null ; }

Target:
public void getExistingStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery < java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > > aQuery , org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.common.businessentities.StorageDomainType domainType , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType , java.lang.String path ) { aQuery.converterCallback = new org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.CastingConverter < > ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetExistingStorageDomainList , new org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters ( hostId , storageType , domainType , path ) , aQuery ) ; }
Source:
public void bondWithNoSlaves ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface bond = createBond ( null ) ; mockExistingIfaces ( bond ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( createParametersForBond ( bond , java.util.Collections.< org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > emptyList ( ) ) ) ; validateAndExpectViolation ( helper , VdcBllMessages.NETWORK_BOND_PARAMETERS_INVALID ) ; }

Target:
public void unmanagedVlanAddedToNic ( ) { org.ovirt.engine.core.common.businessentities.VdsNetworkInterface nic = createNic ( "nic0" , null ) ; mockExistingIfaces ( nic ) ; org.ovirt.engine.core.bll.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic , createVlan ( nic.getName ( ) , 100 , "net" ) ) ) ; validateAndExpectViolation ( helper , VdcBllMessages.NETWORK_NOT_EXISTS_IN_CURRENT_CLUSTER ) ; }
Source:
private void setUpGetCertuficateExpectations ( int times ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsCertificateSubjectByVmId , org.ovirt.engine.core.common.queries.GetVmByVmIdParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ i ] } , org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.CERTIFICATE ) ; } }

Target:
private void setUpGetCertuficateExpectations ( int times ) throws java.lang.Exception { for ( int i = 0 ; i < times ; i ++ ) { setUpGetEntityExpectations ( VdcQueryType.GetVdsCertificateSubjectByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ i ] } , org.ovirt.engine.api.restapi.resource.BackendVmsResourceTest.CERTIFICATE ) ; } }
Source:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { java.lang.String prefix = ( ( java.lang.String ) ( returnValue ) ) ; org.ovirt.engine.ui.uicommonweb.models.hosts.ConfigureLocalStorageModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.ConfigureLocalStorageModel ) ( target ) ) ; if ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( prefix ) ) ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel pathModel = model.getStorage ( ) . getPath ( ) ; pathModel.setEntity ( prefix ) ; pathModel.setIsChangable ( false ) ; } configureLocalStorage3 ( model ) ; }

Target:
private void configureLocalStorage2 ( org.ovirt.engine.ui.uicommonweb.models.hosts.ConfigureLocalStorageModel model ) { java.lang.String prefix = ( ( java.lang.String ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigValuePreConverted ( ConfigurationValues.RhevhLocalFSPath ) ) ) ; if ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( prefix ) ) ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel pathModel = model.getStorage ( ) . getPath ( ) ; pathModel.setEntity ( prefix ) ; pathModel.setIsChangable ( false ) ; } configureLocalStorage3 ( model ) ; }
Source:
private void run ( ) { java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > list = new java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) ; for ( java.lang.Object item : getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.VM a = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( item ) ) ; list.add ( new org.ovirt.engine.core.common.action.RunVmParams ( a.getId ( ) ) ) ; } org.ovirt.engine.ui.frontend.Frontend.RunMultipleAction ( VdcActionType.RunVm , list , new org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { } } , null ) ; }

Target:
private void pause ( ) { java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > list = new java.util.ArrayList < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) ; for ( java.lang.Object item : getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.VM a = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( item ) ) ; list.add ( new org.ovirt.engine.core.common.action.VmOperationParameterBase ( a.getId ( ) ) ) ; } org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runMultipleAction ( VdcActionType.HibernateVm , list , new org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { } } , null ) ; }
Source:
public void canDoActionNotEnoughSpace ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmForSpace ( ) ; initVmDiskImage ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.MoveOrCopyDiskCommandTest.mockStorageDomainValidatorWithoutSpace ( ) ) . when ( command ) . createStorageDomainValidator ( ) ; org.mockito.Mockito.doReturn ( new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ) . when ( command ) . getAllImageSnapshots ( ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ; }

Target:
public void canDoActionDiskIsLocked ( ) throws java.lang.Exception { initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; command.getImage ( ) . setImageStatus ( ImageStatus.LOCKED ) ; org.mockito.Mockito.doReturn ( vmDeviceDao ) . when ( command ) . getVmDeviceDAO ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED.toString ( ) ) ) ; }
Source:
protected void ExecuteVdsBrokerCommand ( ) { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct bonds = new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct ( ) ; org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct networks = new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct ( ) ; fillModifiedNetworks ( networks ) ; fillRemovedNetworks ( networks ) ; fillModifiedBonds ( bonds ) ; fillRemovedBonds ( bonds ) ; org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct options = generateOptions ( ) ; httpTask = org.ovirt.engine.core.vdsbroker.vdsbroker.SetupNetworksVDSCommand.getBroker ( ) . setupNetworks ( networks , bonds , options ) ; }

Target:
protected void ExecuteVdsBrokerCommand ( ) { httpTask = org.ovirt.engine.core.vdsbroker.vdsbroker.SetupNetworksVDSCommand.getBroker ( ) . setupNetworks ( generateNetworks ( ) , generateBonds ( ) , generateOptions ( ) ) ; }
Source:
public void getCPUList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Version version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ServerCpu > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllServerCpuList , new org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters ( version ) , aQuery ) ; }

Target:
public void getDataCenterMaxNameLength ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) : 1 ; } } ; getConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.StoragePoolNameSizeLimit , getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturnForXmlRpc disconnectStorageServer ( int serverType , java.lang.String spUUID , java.util.Map < java.lang.String , java.lang.String > [ ] args ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "StoragePool.disconnectStorageServer" ) . withParameter ( "storagepoolID" , spUUID ) . withParameter ( "domainType" , serverType ) . withParameter ( "connectionParams" , args ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withResponseKey ( "statuslist" ) . withResponseType ( java.lang.Object [ ] . class ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturnForXmlRpc ( response ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturn disconnectStorageServer ( int serverType , java.lang.String spUUID , java.util.Map < java.lang.String , java.lang.String > [ ] args ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "StoragePool.disconnectStorageServer" ) . withParameter ( "storagepoolID" , spUUID ) . withParameter ( "domainType" , serverType ) . withParameter ( "connectionParams" , args ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withResponseKey ( "statuslist" ) . withResponseType ( java.lang.Object [ ] . class ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturn ( response ) ; }
Source:
public void setItems ( java.lang.Iterable value ) { if ( value != null ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > itemList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > ) ( value ) ) ; java.util.Collections.sort ( itemList , new org.ovirt.engine.ui.uicommonweb.Linq.VmTemplateComparator ( ) ) ; } super . setItems ( value ) ; }

Target:
public void setItems ( java.util.Collection value ) { if ( value != null ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > itemList = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > ) ( value ) ) ; java.util.Collections.sort ( itemList , new org.ovirt.engine.ui.uicommonweb.Linq.VmTemplateComparator ( ) ) ; } super . setItems ( value ) ; }
Source:
public void setdisplay_ip ( java.lang.String value ) { if ( value.startsWith ( "0" ) ) { value = host.gethost_name ( ) ; } super . setdisplay_ip ( value ) ; }

Target:
public void setdisplay_ip ( java.lang.String value ) { if ( ( host.getConsoleAddress ( ) ) != null ) { super . setdisplay_ip ( host.getConsoleAddress ( ) ) ; } else if ( value.startsWith ( "0" ) ) { super . setdisplay_ip ( host.gethost_name ( ) ) ; } else { super . setdisplay_ip ( value ) ; } }
Source:
protected org.ovirt.engine.api.model.NIC getNic ( boolean withNetwork ) { org.ovirt.engine.api.model.NIC nic = new org.ovirt.engine.api.model.NIC ( ) ; nic.setMac ( new org.ovirt.engine.api.model.Mac ( ) ) ; nic.getMac ( ) . setAddress ( "00:1a:4a:16:85:18" ) ; if ( withNetwork ) { org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( GUIDS [ 0 ] . toString ( ) ) ; } org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( GUIDS [ 0 ] . toString ( ) ) ; return nic ; }

Target:
protected org.ovirt.engine.api.model.Nic getNic ( boolean withNetwork ) { org.ovirt.engine.api.model.Nic nic = new org.ovirt.engine.api.model.Nic ( ) ; nic.setMac ( new org.ovirt.engine.api.model.Mac ( ) ) ; nic.getMac ( ) . setAddress ( "00:1a:4a:16:85:18" ) ; if ( withNetwork ) { org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( GUIDS [ 0 ] . toString ( ) ) ; } org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( GUIDS [ 0 ] . toString ( ) ) ; return nic ; }
Source:
public void eventRaised ( org.ovirt.engine.core.compat.Event ev , java.lang.Object sender , org.ovirt.engine.core.compat.EventArgs args ) { if ( ( ( getIsImportGlusterConfiguration ( ) . getEntity ( ) ) != null ) && ( ( java.lang.Boolean ) ( getIsImportGlusterConfiguration ( ) . getEntity ( ) ) ) ) { getGlusterHostAddress ( ) . setIsChangable ( true ) ; getGlusterHostPassword ( ) . setIsChangable ( true ) ; } else { getGlusterHostAddress ( ) . setIsChangable ( false ) ; getGlusterHostPassword ( ) . setIsChangable ( false ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.core.compat.Event ev , java.lang.Object sender , org.ovirt.engine.core.compat.EventArgs args ) { setIsFingerprintVerified ( false ) ; fetchFingerprint ( ( ( java.lang.String ) ( getGlusterHostAddress ( ) . getEntity ( ) ) ) ) ; }
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.getevent_notification_method ( ) ) == ( current.getevent_notification_method ( ) ) ) ) { retValue = true ; break ; } } return retValue ; }

Target:
private static boolean ValidateSubscription ( java.lang.Iterable < org.ovirt.engine.core.common.businessentities.EventSubscriber > subscriptions , org.ovirt.engine.core.common.businessentities.EventSubscriber current ) { boolean retValue = false ; for ( org.ovirt.engine.core.common.businessentities.EventSubscriber eventSubscriber : subscriptions ) { if ( ( ( eventSubscriber.getSubscriberId ( ) . equals ( current.getSubscriberId ( ) ) ) && ( org.apache.commons.lang.StringUtils.equals ( eventSubscriber.getEventUpName ( ) , current.getEventUpName ( ) ) ) ) && ( ( eventSubscriber.getEventNotificationMethod ( ) ) == ( current.getEventNotificationMethod ( ) ) ) ) { retValue = true ; break ; } } return retValue ; }
Source:
public void testFaultyResize ( ) { org.mockito.Mockito.when ( diskDao.get ( diskImageGuid ) ) . thenReturn ( createDiskImage ( ) ) ; org.ovirt.engine.core.common.action.UpdateVmDiskParameters parameters = createParameters ( ) ; ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( parameters.getDiskInfo ( ) ) ) . setSize ( ( ( parameters.getDiskInfo ( ) . getSize ( ) ) / 2 ) ) ; initializeCommand ( parameters ) ; org.junit.Assert.assertFalse ( command.validateCanResizeDisk ( ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.assertCanDoActionMessages ( "wrong failure" , command , EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL ) ; }

Target:
public void testFaultyResize ( ) { org.mockito.Mockito.when ( diskDao.get ( diskImageGuid ) ) . thenReturn ( createDiskImage ( ) ) ; org.ovirt.engine.core.common.action.UpdateVmDiskParameters parameters = createParameters ( ) ; ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( parameters.getDiskInfo ( ) ) ) . setSize ( ( ( parameters.getDiskInfo ( ) . getSize ( ) ) / 2 ) ) ; initializeCommand ( parameters ) ; org.junit.Assert.assertFalse ( command.validateCanResizeDisk ( ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.assertValidationMessages ( "wrong failure" , command , EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL ) ; }
Source:
protected void initProfiles ( ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > profiles = new java.util.LinkedList < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > ( ) ; org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel newModel = new org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel ( getSourceListModel ( ) , getSelectedDc ( ) . getcompatibility_version ( ) , false , getSelectedDc ( ) . getId ( ) ) ; profiles.add ( newModel ) ; getProfiles ( ) . setItems ( profiles ) ; }

Target:
protected void initProfiles ( ) { java.lang.Iterable < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > existingProfiles = getProfiles ( ) . getItems ( ) ; if ( existingProfiles == null ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > profiles = new java.util.LinkedList < org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel > ( ) ; profiles.add ( createDefaultProfile ( ) ) ; getProfiles ( ) . setItems ( profiles ) ; } else { for ( org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel profile : existingProfiles ) { profile.updateDc ( getSelectedDc ( ) . getcompatibility_version ( ) , false , getSelectedDc ( ) . getId ( ) , null ) ; } } }
Source:
private void externalNetworkPortMirroringTest ( boolean externalNetwork , boolean portMirroring , org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher ) { org.ovirt.engine.core.common.businessentities.network.Network network = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.network.Network.class ) ; org.mockito.Mockito.when ( network.isExternal ( ) ) . thenReturn ( externalNetwork ) ; org.mockito.Mockito.when ( nic.isPortMirroring ( ) ) . thenReturn ( portMirroring ) ; org.junit.Assert.assertThat ( validator.portMirroringNotSetIfExternalNetwork ( network ) , matcher ) ; }

Target:
private void vnicProfileTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , boolean networkLinkingSupported , org.ovirt.engine.core.compat.Guid vnicProfileId ) { mockConfigRule.mockConfigValue ( ConfigValues.NetworkLinkingSupported , version , networkLinkingSupported ) ; org.mockito.Mockito.when ( nic.getVnicProfileId ( ) ) . thenReturn ( vnicProfileId ) ; org.junit.Assert.assertThat ( validator.emptyNetworkValid ( ) , matcher ) ; }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel vmModel = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( target ) ) ; vmModel.set_MaxMemSize64 ( ( ( java.lang.Integer ) ( returnValue ) ) ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { getBehavior ( ) . deactivateInstanceTypeManager ( ) ; updateWatchdogItems ( ( ( java.util.HashSet < org.ovirt.engine.core.common.businessentities.VmWatchdogType > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) ) ; getBehavior ( ) . activateInstanceTypeManager ( ) ; }
Source:
public void testChangeCdUsingQueryParameter ( ) throws java.lang.Exception { resource.setUriInfo ( setUpChangeCdUriQueryExpectations ( ) ) ; setUpEntityQueryExpectations ( getVm ( ) ) ; setUpActionExpectations ( ActionType.ChangeDisk , org.ovirt.engine.core.common.action.ChangeDiskCommandParameters.class , new java.lang.String [ ] { "CdImagePath" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.A_ISO } , true , true ) ; org.ovirt.engine.api.model.Cdrom cdrom = getCdrom ( org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.A_ISO ) ; cdrom = resource.update ( cdrom ) ; assertTrue ( cdrom.isSetFile ( ) ) ; }

Target:
public void testChangeCdUsingQueryParameter ( ) throws java.lang.Exception { resource.setUriInfo ( setUpChangeCdUriQueryExpectations ( ) ) ; setUpEntityQueryExpectations ( getVm ( ) ) ; setUpActionExpectations ( ActionType.ChangeDisk , org.ovirt.engine.core.common.action.ChangeDiskCommandParameters.class , new java.lang.String [ ] { "CdImagePath" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.A_ISO } , true , true ) ; org.ovirt.engine.api.model.Cdrom cdrom = getCdrom ( org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.A_ISO ) ; cdrom = resource.update ( cdrom ) ; org.junit.Assert.assertTrue ( cdrom.isSetFile ( ) ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.VM initializeMock ( final int domainSizeGB , final int sizeRequired ) { mockVmTemplateDAOReturnVmTemplate ( ) ; mockDiskImageDAOGetSnapshotById ( ) ; mockStorageDomainDAOGetForStoragePool ( domainSizeGB ) ; mockStorageDomainDAOGet ( domainSizeGB ) ; mockGetImageDomainsListVdsCommand ( ) ; mockConfig ( ) ; mockConfigSizeRequirements ( sizeRequired ) ; org.ovirt.engine.core.common.businessentities.VM vm = org.ovirt.engine.core.bll.AddVmCommandTest.createVm ( ) ; return vm ; }

Target:
private void mockOsRepository ( ) { org.ovirt.engine.core.common.utils.SimpleDependecyInjector.getInstance ( ) . bind ( org.ovirt.engine.core.common.osinfo.OsRepository.class , osRepository ) ; }
Source:
public static void GetMaxNumOfVmSockets ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 1 ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxNumOfVmSockets ) ; tempVar.setVersion ( version ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( tempVar , aQuery ) ; }

Target:
public static void getMaxNumOfVmSockets ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 1 ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.MaxNumOfVmSockets ) ; tempVar.setVersion ( version ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( tempVar , aQuery ) ; }
Source:
private org.ovirt.engine.core.bll.ValidationResult validateCoherentNicIdentification ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment ) { return org.ovirt.engine.core.bll.network.host.HostSetupNetworksValidator.validateCoherentIdentification ( ( ( attachment.getId ( ) ) == null ? null : attachment.getId ( ) . toString ( ) ) , attachment.getNicId ( ) , attachment.getNicName ( ) , EngineMessage.NETWORK_ATTACHMENT_REFERENCES_NICS_INCOHERENTLY , existingInterfacesMap ) ; }

Target:
private org.ovirt.engine.core.bll.ValidationResult validateCoherentNicIdentification ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment ) { return hostSetupNetworksValidatorHelper.validateCoherentIdentification ( java.lang.String.valueOf ( attachment.getId ( ) ) , attachment.getNicId ( ) , attachment.getNicName ( ) , EngineMessage.NETWORK_ATTACHMENT_REFERENCES_NICS_INCOHERENTLY , existingInterfacesMap ) ; }
Source:
public static void initDefaultOSes ( ) { org.ovirt.engine.ui.frontend.AsyncQuery callback = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; callback.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.defaultOSes = ( ( java.util.HashMap < org.ovirt.engine.core.common.businessentities.ArchitectureType , java.lang.Integer > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.OsRepository , new org.ovirt.engine.core.common.queries.OsQueryParameters ( org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb.GetDefaultOSes ) , callback ) ; }

Target:
private void initMigrationSupportMap ( ) { org.ovirt.engine.ui.frontend.AsyncQuery callback = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; callback.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { migrationSupport = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetArchitectureCapabilities , new org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters ( org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters.ArchCapabilitiesVerb.GetMigrationSupport ) , callback ) ; }
Source:
private void doTestBadAddDisk ( boolean canDo , boolean success , java.lang.String detail ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( VdcActionType.AddDisk , org.ovirt.engine.core.common.action.AddDiskParameters.class , new java.lang.String [ ] { "VmId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.AbstractBackendDisksResourceTest.PARENT_ID } , canDo , success ) ) ; org.ovirt.engine.api.model.Disk model = getModel ( 0 ) ; model.setSize ( ( 1024 * 1024L ) ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }

Target:
private void doTestBadAddDisk ( boolean canDo , boolean success , java.lang.String detail ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( VdcActionType.AddDisk , org.ovirt.engine.core.common.action.AddDiskParameters.class , new java.lang.String [ ] { "VmId" } , new java.lang.Object [ ] { PARENT_ID } , canDo , success ) ) ; org.ovirt.engine.api.model.Disk model = getModel ( 0 ) ; model.setSize ( ( 1024 * 1024L ) ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , detail ) ; } }
Source:
public 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.getInstance ( ) . runQuery ( VdcQueryType.GetVmTemplatesDisks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( templateId ) , aQuery ) ; }

Target:
public void getStorageDomainList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StorageDomain > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( java.util.Collections.emptyList ( ) ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( java.util.Collections.emptyList ( ) ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { resource.remove ( ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { org.junit.Assert.assertNotNull ( wae.getResponse ( ) ) ; org.junit.Assert.assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }
Source:
private java.lang.String getMemoryVolumeFromActiveSnapshotInExportDomain ( ) { for ( org.ovirt.engine.core.common.businessentities.Snapshot snapshot : getVm ( ) . getSnapshots ( ) ) { if ( ( snapshot.getType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType.ACTIVE ) ) return snapshot.getMemoryVolume ( ) ; } org.ovirt.engine.core.bll.ImportVmCommand.log.warnFormat ( "VM {0} doesn't have active snapshot in export domain" , getVmId ( ) ) ; return org.apache.commons.lang.StringUtils.EMPTY ; }

Target:
private org.ovirt.engine.core.common.businessentities.Snapshot getActiveSnapshot ( ) { for ( org.ovirt.engine.core.common.businessentities.Snapshot snapshot : getVm ( ) . getSnapshots ( ) ) { if ( ( snapshot.getType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType.ACTIVE ) ) return snapshot ; } org.ovirt.engine.core.bll.ImportVmCommand.log.warn ( "VM '{}' doesn't have active snapshot in export domain" , getVmId ( ) ) ; return null ; }
Source:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlan ( java.lang.String baseIfaceName , int vlanId , java.lang.String networkName ) { return createVdsInterface ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , ( ( baseIfaceName + "." ) + vlanId ) , false , null , baseIfaceName , vlanId , networkName , true , null , false , null ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlan ( java.lang.String baseIfaceName , int vlanId , java.lang.String networkName ) { return createVdsInterface ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , ( ( baseIfaceName + "." ) + vlanId ) , false , null , baseIfaceName , vlanId , networkName , true , null , false , null , org.ovirt.engine.core.bll.network.host.SetupNetworksHelperTest.DEFAULT_SPEED ) ; }
Source:
public static void getVmById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }

Target:
public static void getVmNextRunConfiguration ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmNextRunConfiguration , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
public void attemptToFenceJob ( ) { org.ovirt.engine.core.common.businessentities.VdsmImageLocationInfo info = ( ( org.ovirt.engine.core.common.businessentities.VdsmImageLocationInfo ) ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) . getVolInfo ( ) ) ) ; org.ovirt.engine.core.common.action.FenceVolumeJobCommandParameters parameters = new org.ovirt.engine.core.common.action.FenceVolumeJobCommandParameters ( info ) ; parameters.setParentCommand ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getActionType ( ) ) ; parameters.setParentParameters ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) ) ; parameters.setStoragePoolId ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) . getStoragePoolId ( ) ) ; parameters.setEndProcedure ( VdcActionParametersBase.EndProcedure.COMMAND_MANAGED ) ; runInternalActionWithTasksContext ( VdcActionType.FenceVolumeJob , parameters ) ; }

Target:
public void attemptToFenceJob ( ) { org.ovirt.engine.core.common.businessentities.VdsmImageLocationInfo info = ( ( org.ovirt.engine.core.common.businessentities.VdsmImageLocationInfo ) ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) . getVolInfo ( ) ) ) ; org.ovirt.engine.core.common.action.FenceVolumeJobCommandParameters parameters = new org.ovirt.engine.core.common.action.FenceVolumeJobCommandParameters ( info ) ; parameters.setParentCommand ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getActionType ( ) ) ; parameters.setParentParameters ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) ) ; parameters.setStoragePoolId ( org.ovirt.engine.core.bll.storage.disk.image.AmendVolumeCommand.getParameters ( ) . getStoragePoolId ( ) ) ; parameters.setEndProcedure ( VdcActionParametersBase.EndProcedure.COMMAND_MANAGED ) ; runInternalActionWithTasksContext ( ActionType.FenceVolumeJob , parameters ) ; }
Source:
public void testUpdateSnapshotStatusByName ( ) { dao.updateSnapshotStatusByName ( existingSnapshot.getVolumeId ( ) , existingSnapshot.getSnapshotName ( ) , GlusterSnapshotStatus.STOPPED ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity snapshot = dao.getById ( existingSnapshot.getSnapshotId ( ) ) ; org.junit.Assert.assertNotNull ( snapshot ) ; org.junit.Assert.assertFalse ( snapshot.equals ( existingSnapshot ) ) ; existingSnapshot.setStatus ( GlusterSnapshotStatus.STOPPED ) ; org.junit.Assert.assertEquals ( existingSnapshot , snapshot ) ; }

Target:
public void testUpdateSnapshotStatusByName ( ) { dao.updateSnapshotStatusByName ( existingSnapshot.getVolumeId ( ) , existingSnapshot.getSnapshotName ( ) , GlusterSnapshotStatus.DEACTIVATED ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity snapshot = dao.getById ( existingSnapshot.getSnapshotId ( ) ) ; org.junit.Assert.assertNotNull ( snapshot ) ; org.junit.Assert.assertFalse ( snapshot.equals ( existingSnapshot ) ) ; existingSnapshot.setStatus ( GlusterSnapshotStatus.DEACTIVATED ) ; org.junit.Assert.assertEquals ( existingSnapshot , snapshot ) ; }
Source:
public org.ovirt.engine.api.model.AffinityLabel update ( org.ovirt.engine.api.model.AffinityLabel incoming ) { org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > labelResolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetLabelById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; org.ovirt.engine.core.common.businessentities.Label entity = getEntity ( labelResolver , true ) ; org.ovirt.engine.api.model.AffinityLabel label = performUpdate ( incoming , entity , map ( entity ) , labelResolver , VdcActionType.UpdateLabel , new org.ovirt.engine.api.restapi.resource.BackendAffinityLabelResource.UpdateParametersProvider ( ) ) ; return label ; }

Target:
public org.ovirt.engine.api.model.AffinityLabel update ( org.ovirt.engine.api.model.AffinityLabel incoming ) { org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > labelResolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetLabelById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; org.ovirt.engine.core.common.businessentities.Label entity = getEntity ( labelResolver , true ) ; org.ovirt.engine.api.model.AffinityLabel label = performUpdate ( incoming , entity , map ( entity ) , labelResolver , ActionType.UpdateLabel , new org.ovirt.engine.api.restapi.resource.BackendAffinityLabelResource.UpdateParametersProvider ( ) ) ; return label ; }
Source:
protected void addVmPayload ( ) { org.ovirt.engine.core.common.businessentities.VmPayload payload = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmPayload ( ) ; if ( payload != null ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmId ( ) ) , VmDeviceGeneralType.DISK , payload.getType ( ) , payload.getSpecParams ( ) , true , true , null ) ; } }

Target:
protected void addVmPayload ( ) { org.ovirt.engine.core.common.businessentities.VmPayload payload = org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmPayload ( ) ; if ( payload != null ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmId ( ) ) , VmDeviceGeneralType.DISK , payload.getType ( ) , payload.getSpecParams ( ) , true , true , null ) ; } }
Source:
public void rollback ( ) { super . rollback ( ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Object > ( ) { @ java.lang.Override public java.lang.Object runInTransaction ( ) { if ( ! ( getParameters ( ) . isLeaveLocked ( ) ) ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage = getDestinationDiskImage ( ) ; if ( diskImage != null ) { getImageDao ( ) . updateStatus ( diskImage.getImage ( ) . getId ( ) , ImageStatus.OK ) ; } unLockImage ( ) ; } return null ; } } ) ; }

Target:
public void onRollback ( ) { org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Object > ( ) { @ java.lang.Override public java.lang.Object runInTransaction ( ) { if ( ! ( getParameters ( ) . isLeaveLocked ( ) ) ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage = getDestinationDiskImage ( ) ; if ( diskImage != null ) { getImageDao ( ) . updateStatus ( diskImage.getImage ( ) . getId ( ) , ImageStatus.OK ) ; } unLockImage ( ) ; } return null ; } } ) ; }
Source:
public void parseLunFromXmlRpcReturnsUnknownForNoField ( ) throws java.lang.Exception { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct xlun = org.mockito.Mockito.mock ( org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct.class ) ; org.mockito.Mockito.when ( xlun.contains ( GetDeviceListVDSCommand.DEVTYPE_FIELD ) ) . thenReturn ( false ) ; org.ovirt.engine.core.common.businessentities.LUNs lun = org.ovirt.engine.core.vdsbroker.vdsbroker.GetDeviceListVDSCommand.ParseLunFromXmlRpc ( xlun ) ; org.junit.Assert.assertEquals ( StorageType.UNKNOWN , lun.getLunType ( ) ) ; }

Target:
private static void testParseLunFromXmlRpcForDevtypeField ( org.ovirt.engine.core.common.businessentities.StorageType expectedStorageType , java.lang.String mockDevtype ) { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct xlun = new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct ( ) ; xlun.add ( GetDeviceListVDSCommand.DEVTYPE_FIELD , mockDevtype ) ; org.ovirt.engine.core.common.businessentities.LUNs lun = org.ovirt.engine.core.vdsbroker.vdsbroker.GetDeviceListVDSCommand.ParseLunFromXmlRpc ( xlun ) ; org.junit.Assert.assertEquals ( expectedStorageType , lun.getLunType ( ) ) ; }
Source:
public void failsIfImported ( ) throws java.lang.Exception { org.mockito.Mockito.when ( hostedEngineHelper.getStorageDomain ( ) ) . thenReturn ( new org.ovirt.engine.core.common.businessentities.StorageDomainStatic ( ) ) ; cmd.validate ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.assertValidationMessages ( "" , cmd , EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST ) ; org.mockito.Mockito.verify ( backend , org.mockito.Mockito.times ( 0 ) ) . runInternalQuery ( org.mockito.Matchers.eq ( VdcQueryType.GetExistingStorageDomainList ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class ) ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.times ( 0 ) ) . executeCommand ( ) ; }

Target:
public void failsIfImported ( ) throws java.lang.Exception { org.mockito.Mockito.when ( hostedEngineHelper.getStorageDomain ( ) ) . thenReturn ( new org.ovirt.engine.core.common.businessentities.StorageDomainStatic ( ) ) ; mockGetExistingDomain ( true ) ; cmd.init ( ) ; cmd.validate ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.assertValidationMessages ( "" , cmd , EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.times ( 0 ) ) . executeCommand ( ) ; }
Source:
public void commandFailsSlaveHostInvalid ( ) { org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeGeoRepSessionCommandTest.SUPPORTED_VERSION ) . when ( cluster ) . getCompatibilityVersion ( ) ; org.mockito.Mockito.doReturn ( volume ) . when ( command ) . getSlaveVolume ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }

Target:
public void commandFailsSlaveHostInvalid ( ) { org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeGeoRepSessionCommandTest.SUPPORTED_VERSION ) . when ( cluster ) . getCompatibilityVersion ( ) ; org.mockito.Mockito.doReturn ( volume ) . when ( command ) . getSlaveVolume ( ) ; org.junit.jupiter.api.Assertions.assertFalse ( command.validate ( ) ) ; }
Source:
public org.ovirt.engine.core.bll.tasks.SPMAsyncTask concreteCreateTask ( org.ovirt.engine.core.compat.Guid taskId , org.ovirt.engine.core.bll.CommandBase command , org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo asyncTaskCreationInfo , org.ovirt.engine.core.common.action.VdcActionType parentCommand ) { org.ovirt.engine.core.common.asynctasks.AsyncTaskParameters p = new org.ovirt.engine.core.common.asynctasks.AsyncTaskParameters ( asyncTaskCreationInfo , getAsyncTask ( taskId , command , asyncTaskCreationInfo , parentCommand ) ) ; p.setEntityInfo ( command.getParameters ( ) . getEntityInfo ( ) ) ; return createTask ( internalGetTaskType ( command ) , p ) ; }

Target:
public org.ovirt.engine.core.common.action.VdcReturnValueBase endAction ( org.ovirt.engine.core.bll.tasks.interfaces.SPMTask task , org.ovirt.engine.core.bll.job.ExecutionContext context ) { return coCoAsyncTaskHelper.endAction ( task , context ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.AlignmentScanReturnForXmlRpc getDiskAlignment ( java.lang.String vmId , java.util.Map < java.lang.String , java.lang.String > driveSpecs ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "VM.getDiskAlignment" ) . withParameter ( "vmID" , vmId ) . withParameter ( "disk" , driveSpecs ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withResponseKey ( "alignment" ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.AlignmentScanReturnForXmlRpc ( response ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.AlignmentScanReturn getDiskAlignment ( java.lang.String vmId , java.util.Map < java.lang.String , java.lang.String > driveSpecs ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "VM.getDiskAlignment" ) . withParameter ( "vmID" , vmId ) . withParameter ( "disk" , driveSpecs ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withResponseKey ( "alignment" ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.AlignmentScanReturn ( response ) ; }