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 , storageDomain.getStatus ( ) . name ( ) ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
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 ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturnForXmlRpc validateStorageServerConnection ( int serverType , java.lang.String spUUID , java.util.Map < java.lang.String , java.lang.String > [ ] args ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.validateStorageServerConnection ( serverType , spUUID , args ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc glusterHookDisable ( java.lang.String glusterCommand , java.lang.String stage , java.lang.String hookName ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.glusterHookDisable ( glusterCommand , stage , hookName ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }
Source:
public void getClusterFeaturesByClusterId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.Set < org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature > ) ( source ) ) : new java.util.HashSet < org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetClusterFeaturesByClusterId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( clusterId ) , aQuery ) ; }

Target:
public void getStorageDevices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hostId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterStorageDevices , new org.ovirt.engine.core.common.queries.IdQueryParameters ( hostId ) , aQuery ) ; }
Source:
private void mockStoragePool ( ) { final org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( storagePoolDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( pool ) ; }

Target:
private void mockStoragePool ( ) { final org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setStatus ( StoragePoolStatus.Up ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( storagePoolDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( pool ) ; }
Source:
protected void runSynchronizeOperation ( org.ovirt.engine.core.bll.storage.ActivateDeactivateSingleAsyncOperationFactory factory , java.lang.Object ... addionalParams ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > allRunningVdsInPool = getAllRunningVdssInPool ( ) ; java.util.ArrayList < java.lang.Object > parameters = InitAsyncOperationParameters ( allRunningVdsInPool ) ; if ( ( addionalParams.length ) > 0 ) { parameters.addAll ( java.util.Arrays.asList ( addionalParams ) ) ; } org.ovirt.engine.core.utils.SyncronizeNumberOfAsyncOperations sync = new org.ovirt.engine.core.utils.SyncronizeNumberOfAsyncOperations ( allRunningVdsInPool.size ( ) , parameters , factory ) ; sync.Execute ( ) ; }

Target:
protected void runSynchronizeOperation ( org.ovirt.engine.core.bll.storage.ActivateDeactivateSingleAsyncOperationFactory factory , java.lang.Object ... addionalParams ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > allRunningVdsInPool = getAllRunningVdssInPool ( ) ; java.util.ArrayList < java.lang.Object > parameters = initAsyncOperationParameters ( allRunningVdsInPool ) ; if ( ( addionalParams.length ) > 0 ) { parameters.addAll ( java.util.Arrays.asList ( addionalParams ) ) ; } org.ovirt.engine.core.utils.SyncronizeNumberOfAsyncOperations sync = new org.ovirt.engine.core.utils.SyncronizeNumberOfAsyncOperations ( allRunningVdsInPool.size ( ) , parameters , factory ) ; sync.Execute ( ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.qos.QosBase createQosEntity ( java.sql.ResultSet rs ) throws java.sql.SQLException { org.ovirt.engine.core.common.businessentities.qos.QosType qosType = org.ovirt.engine.core.common.businessentities.qos.QosType.forValue ( rs.getInt ( "qos_type" ) ) ; switch ( qosType ) { case STORAGE : return StorageQosDaoDbFacadeImpl.StorageDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; case CPU : return CpuQosDaoDbFacadeImpl.CpuDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; case NETWORK : return NetworkQoSDaoFacadeImpl.NetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; default : org.ovirt.engine.core.dao.qos.AllQosBaseDaoFacadeImpl.log.debugFormat ( "not handled/missing qos_type" , qosType ) ; break ; } return null ; }

Target:
protected org.ovirt.engine.core.common.businessentities.qos.QosBase createQosEntity ( java.sql.ResultSet rs ) throws java.sql.SQLException { org.ovirt.engine.core.common.businessentities.qos.QosType qosType = org.ovirt.engine.core.common.businessentities.qos.QosType.forValue ( rs.getInt ( "qos_type" ) ) ; switch ( qosType ) { case STORAGE : return StorageQosDaoDbFacadeImpl.StorageDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; case CPU : return CpuQosDaoDbFacadeImpl.CpuDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; case NETWORK : return NetworkQoSDaoFacadeImpl.NetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; case HOSTNETWORK : return HostNetworkQosDaoDbFacadeImpl.HostNetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity ( rs ) ; default : org.ovirt.engine.core.dao.qos.AllQosBaseDaoFacadeImpl.log.debug ( "not handled/missing qos_type '{}'" , qosType ) ; break ; } return null ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters parameters = generateSyncAllHostNetworksParameters ( ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase retVal = runInternalAction ( ActionType.PersistentHostSetupNetworks , parameters , cloneContextAndDetachFromParent ( ) ) ; if ( ! ( retVal.getSucceeded ( ) ) ) { propagateFailure ( retVal ) ; } else { setSucceeded ( true ) ; } }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters parameters = generateSyncAllHostNetworksParameters ( ) ; org.ovirt.engine.core.common.action.ActionReturnValue retVal = runInternalAction ( ActionType.PersistentHostSetupNetworks , parameters , cloneContextAndDetachFromParent ( ) ) ; if ( ! ( retVal.getSucceeded ( ) ) ) { propagateFailure ( retVal ) ; } else { setSucceeded ( true ) ; } }
Source:
public java.lang.Boolean call ( ) throws java.lang.Exception { if ( ( _managementNetwork ) != null ) { _parser.cliEnvironmentSet ( VdsmEnv.MANAGEMENT_BRIDGE_NAME , _managementNetwork ) ; } else if ( _isLegacyNode ) { _parser.cliEnvironmentSet ( VdsmEnv.MANAGEMENT_BRIDGE_NAME , org.ovirt.engine.core.utils.NetworkUtils.getDefaultManagementNetworkName ( ) ) ; } else { _parser.cliNoop ( ) ; } return true ; }

Target:
public java.lang.Boolean call ( ) throws java.lang.Exception { if ( ( _managementNetwork ) != null ) { _parser.cliEnvironmentSet ( VdsmEnv.MANAGEMENT_BRIDGE_NAME , _managementNetwork ) ; } else if ( _isLegacyNode ) { final org.ovirt.engine.core.bll.network.cluster.ManagementNetworkUtil managmentNetworkUtil = org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.bll.network.cluster.ManagementNetworkUtil.class ) ; final org.ovirt.engine.core.compat.Guid clusterId = _vds.getVdsGroupId ( ) ; final org.ovirt.engine.core.common.businessentities.network.Network managementNetwork = managmentNetworkUtil.getManagementNetwork ( clusterId ) ; _parser.cliEnvironmentSet ( VdsmEnv.MANAGEMENT_BRIDGE_NAME , managementNetwork.getName ( ) ) ; } else { _parser.cliNoop ( ) ; } return true ; }
Source:
protected boolean checkForRemoveExternalNetworkAvailability ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > providers , java.util.Set < org.ovirt.engine.core.compat.Guid > externalProviderIds ) { for ( org.ovirt.engine.core.common.businessentities.Provider provider : providers ) { if ( externalProviderIds.contains ( provider.getId ( ) ) ) { org.ovirt.engine.core.common.businessentities.ExternalNetworkProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.ExternalNetworkProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; if ( properties.getReadOnly ( ) ) { return true ; } } } return false ; }

Target:
protected boolean checkForRemoveExternalNetworkAvailability ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > providers , java.util.Set < org.ovirt.engine.core.compat.Guid > externalProviderIds ) { for ( org.ovirt.engine.core.common.businessentities.Provider provider : providers ) { if ( externalProviderIds.contains ( provider.getId ( ) ) ) { org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; if ( properties.getReadOnly ( ) ) { return true ; } } } return false ; }
Source:
public static org.ovirt.engine.core.aaa.DirectoryUser fetchPrincipalRecord ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , org.ovirt.engine.api.extensions.ExtMap authRecord ) { return org.ovirt.engine.core.aaa.AuthzUtils.mapPrincipalRecord ( extension , extension.invoke ( new org.ovirt.engine.api.extensions.ExtMap ( ) . mput ( Base.InvokeKeys.COMMAND , Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD ) . mput ( Authn.InvokeKeys.AUTH_RECORD , authRecord ) ) . < org.ovirt.engine.api.extensions.ExtMap > get ( Authz.InvokeKeys.PRINCIPAL_RECORD ) ) ; }

Target:
public static org.ovirt.engine.api.extensions.ExtMap fetchPrincipalRecord ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , org.ovirt.engine.api.extensions.ExtMap authRecord ) { return extension.invoke ( new org.ovirt.engine.api.extensions.ExtMap ( ) . mput ( Base.InvokeKeys.COMMAND , Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD ) . mput ( Authn.InvokeKeys.AUTH_RECORD , authRecord ) . mput ( Authz.InvokeKeys.QUERY_FLAGS , ( ( Authz.QueryFlags.RESOLVE_GROUPS ) | ( Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE ) ) ) ) . < org.ovirt.engine.api.extensions.ExtMap > get ( Authz.InvokeKeys.PRINCIPAL_RECORD ) ; }
Source:
protected void setActionMessageParameters ( ) { addCanDoActionMessage ( VdcBllMessages.VAR__ACTION__HOT_SET_CPUS ) ; addCanDoActionMessage ( VdcBllMessages.VAR__TYPE__VM ) ; addCanDoActionMessage ( java.lang.String.format ( "$clusterVersion %1$s" , org.ovirt.engine.core.bll.HotSetNumberOfCpusCommand.getVm ( ) . getVdsGroupCompatibilityVersion ( ) ) ) ; addCanDoActionMessage ( java.lang.String.format ( "$architecture %1$s" , org.ovirt.engine.core.bll.HotSetNumberOfCpusCommand.getVm ( ) . getClusterArch ( ) ) ) ; }

Target:
protected void setActionMessageParameters ( ) { addCanDoActionMessage ( VdcBllMessages.VAR__ACTION__HOT_SET_CPUS ) ; addCanDoActionMessage ( VdcBllMessages.VAR__TYPE__VM ) ; addCanDoActionMessageVariable ( "clusterVersion" , org.ovirt.engine.core.bll.HotSetNumberOfCpusCommand.getVm ( ) . getVdsGroupCompatibilityVersion ( ) ) ; addCanDoActionMessageVariable ( "architecture" , org.ovirt.engine.core.bll.HotSetNumberOfCpusCommand.getVm ( ) . getClusterArch ( ) ) ; }
Source:
public static void GetHostById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetVdsByVdsId , new org.ovirt.engine.core.common.queries.GetVdsByVdsIdParameters ( id ) , aQuery ) ; }

Target:
public static 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.RunQuery ( VdcQueryType.GetStorageDomainsByStoragePoolId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
private static org.ovirt.engine.api.rsdl.ServiceTreeNode buildNode ( java.lang.Class < ? > resource , java.lang.String path ) { return new org.ovirt.engine.api.rsdl.ServiceTreeNode.Builder ( ) . name ( resource.getSimpleName ( ) ) . path ( path ) . subCollections ( org.ovirt.engine.api.rsdl.ServiceTree.getSubServices ( resource ) ) . actions ( org.ovirt.engine.api.rsdl.ServiceTree.getActions ( resource ) ) . build ( ) ; }

Target:
private static org.ovirt.engine.api.rsdl.ServiceTreeNode buildNode ( java.lang.Class < ? > resource , java.lang.String path ) { org.ovirt.engine.api.rsdl.ServiceTreeNode node = new org.ovirt.engine.api.rsdl.ServiceTreeNode.Builder ( ) . name ( resource.getSimpleName ( ) ) . path ( path ) . subCollections ( org.ovirt.engine.api.rsdl.ServiceTree.getSubServices ( resource ) ) . actions ( org.ovirt.engine.api.rsdl.ServiceTree.getActions ( resource ) ) . build ( ) ; if ( ! ( org.ovirt.engine.api.rsdl.ServiceTree.nodes.containsKey ( resource ) ) ) { org.ovirt.engine.api.rsdl.ServiceTree.nodes.put ( resource , node ) ; } return node ; }
Source:
public void deleteCompletedJobs ( final java.util.Date succeededJobs , final java.util.Date failedJobs ) { updateQuery ( getEntityManager ( ) . createNamedQuery ( "Job.deleteCompletedJobs" ) . setParameter ( "successEndTime" , succeededJobs ) . setParameter ( "failedEndTime" , failedJobs ) . setParameter ( "failStatus" , java.util.EnumSet.of ( JobExecutionStatus.FAILED , JobExecutionStatus.ABORTED , JobExecutionStatus.UNKNOWN ) ) . setParameter ( "successStatus" , JobExecutionStatus.FINISHED ) ) ; }

Target:
public void deleteJobOlderThanDateWithStatus ( java.util.Date sinceDate , java.util.List < org.ovirt.engine.core.common.job.JobExecutionStatus > statusesList ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "end_time" , sinceDate ) . addValue ( "status" , org.apache.commons.lang.StringUtils.join ( statusesList , "," ) ) ; getCallsHandler ( ) . executeModification ( "DeleteJobOlderThanDateWithStatus" , parameterSource ) ; }
Source:
public boolean supportedForUnitVmModel ( org.ovirt.engine.core.common.queries.ConfigurationValues feature , org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model ) { org.ovirt.engine.core.compat.Version version = model.getCompatibilityVersion ( ) ; if ( version == null ) { return false ; } else { return ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( feature , version.getValue ( ) ) ) ) ; } }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { memoryHotUnplugSupport = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; }
Source:
private org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > setupCanAddVmTests ( final int domainSizeGB , final int sizeRequired , final int pctRequired ) { org.ovirt.engine.core.common.businessentities.VM vm = initializeMock ( domainSizeGB , sizeRequired , pctRequired ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = createCommand ( vm ) ; initCommandMethods ( cmd ) ; return cmd ; }

Target:
private org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > setupCanAddVmTests ( final int domainSizeGB , final int sizeRequired , final int pctRequired ) { org.ovirt.engine.core.common.businessentities.VM vm = initializeMock ( domainSizeGB , sizeRequired , pctRequired ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = createCommand ( vm ) ; org.ovirt.engine.core.bll.AddVmCommandTest.initCommandMethods ( cmd ) ; org.mockito.Mockito.doReturn ( createVmTemplate ( ) ) . when ( cmd ) . getVmTemplate ( ) ; return cmd ; }
Source:
protected org.ovirt.engine.core.bll.ValidationResult validateInterfacesConfigured ( org.ovirt.engine.core.common.businessentities.VM vm ) { for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface nic : vm.getInterfaces ( ) ) { if ( ( nic.getVnicProfileId ( ) ) == null ) { return org.ovirt.engine.core.common.FeatureSupported.networkLinking ( vm.getVdsGroupCompatibilityVersion ( ) ) ? org.ovirt.engine.core.bll.ValidationResult.VALID : new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_INTERFACE_NETWORK_NOT_CONFIGURED ) ; } } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
protected org.ovirt.engine.core.bll.ValidationResult validateInterfacesConfigured ( org.ovirt.engine.core.common.businessentities.VM vm ) { for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface nic : vm.getInterfaces ( ) ) { if ( ( nic.getVnicProfileId ( ) ) == null ) { return org.ovirt.engine.core.common.FeatureSupported.networkLinking ( vm.getVdsGroupCompatibilityVersion ( ) ) ? org.ovirt.engine.core.bll.ValidationResult.VALID : new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_INTERFACE_NETWORK_NOT_CONFIGURED ) ; } } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private void testManagementNetworkChange ( boolean managementAfter , boolean emptyCluster , org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > expectedResult ) { org.mockito.Mockito.when ( networkCluster.isManagement ( ) ) . thenReturn ( managementAfter ) ; org.mockito.Mockito.when ( vdsDao.getAllForCluster ( org.ovirt.engine.core.bll.network.cluster.TEST_CLUSTER_ID ) ) . thenReturn ( ( emptyCluster ? java.util.Collections.< org.ovirt.engine.core.common.businessentities.VDS > emptyList ( ) : java.util.Collections.< org.ovirt.engine.core.common.businessentities.VDS > singletonList ( null ) ) ) ; org.junit.Assert.assertThat ( validator.managementNetworkChange ( ) , expectedResult ) ; }

Target:
private void testManagementNetworkChange ( boolean managementAfter , boolean emptyCluster , org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > expectedResult ) { org.mockito.Mockito.when ( networkCluster.isManagement ( ) ) . thenReturn ( managementAfter ) ; org.mockito.Mockito.when ( vdsDao.getAllForCluster ( org.ovirt.engine.core.bll.network.cluster.TEST_CLUSTER_ID ) ) . thenReturn ( ( emptyCluster ? java.util.Collections.emptyList ( ) : java.util.Collections.singletonList ( null ) ) ) ; org.junit.Assert.assertThat ( validator.managementNetworkChange ( ) , expectedResult ) ; }
Source:
public void vmNotHavingPassthroughVnicsMulitpleVmsNotValid ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = initValidatorWithMultipleVms ( 3 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 0 ) . getId ( ) , 0 , 2 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 1 ) . getId ( ) , 3 , 8 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 2 ) . getId ( ) , 0 , 4 ) ; org.junit.Assert.assertThat ( validator.vmNotHavingPassthroughVnics ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_MIGRATION_OF_PASSTHROUGH_VNICS_IS_NOT_SUPPORTED ) ) ; }

Target:
public void vmNotHavingPassthroughVnicsMulitpleVmsNotValid ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmList = initValidatorWithMultipleVms ( 3 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 0 ) . getId ( ) , 0 , 2 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 1 ) . getId ( ) , 3 , 8 ) ; vmNotHavingPassthroughVnicsCommon ( vmList.get ( 2 ) . getId ( ) , 0 , 4 ) ; org.junit.Assert.assertThat ( validator.vmNotHavingPassthroughVnics ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_MIGRATION_OF_PASSTHROUGH_VNICS_IS_NOT_SUPPORTED ) ) ; }
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 [ ] { 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:
public void testAddIncompleteParameters ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Disk model = new org.ovirt.engine.api.model.Disk ( ) ; model.setName ( NAMES [ 0 ] ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Disk" , "add" , "format" , "interface" ) ; } }
Source:
public void getGlusterSwiftServerServices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterServerServicesByClusterId , new org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters ( clusterId , org.ovirt.engine.core.common.businessentities.gluster.ServiceType.GLUSTER_SWIFT ) , aQuery ) ; }

Target:
public void getGlusterHostsNewlyAdded ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId , boolean isFingerprintRequired ) { 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.GetAddedGlusterServers , new org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters ( clusterId , isFingerprintRequired ) , aQuery ) ; }
Source:
public void init ( ) { super . init ( ) ; setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . runVirtualMachinesTitle ( ) ) ; setIsHostTabVisible ( false ) ; setIsCustomPropertiesSheetVisible ( false ) ; getCustomProperties ( ) . setEntity ( vm.getCustomProperties ( ) ) ; }

Target:
protected void onRunOnce ( ) { StartProgress ( null ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.RunVmOnce , createRunVmOnceParams ( ) , new org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback ( ) { @ java.lang.Override public void Executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { StopProgress ( ) ; commandTarget.ExecuteCommand ( runOnceCommand ) ; } } , this ) ; }
Source:
private static void addCdDetails ( org.ovirt.engine.core.common.businessentities.VmDevice vmDevice , java.util.Map < java.lang.String , java.lang.Object > struct ) { struct.put ( VdsProperties.Type , vmDevice.getType ( ) ) ; struct.put ( VdsProperties.Device , vmDevice.getDevice ( ) ) ; struct.put ( VdsProperties.Index , "2" ) ; struct.put ( VdsProperties.INTERFACE , VdsProperties.Ide ) ; struct.put ( VdsProperties.ReadOnly , java.lang.Boolean.TRUE.toString ( ) ) ; struct.put ( VdsProperties.Shareable , java.lang.Boolean.FALSE.toString ( ) ) ; }

Target:
private static void addFloppyDetails ( org.ovirt.engine.core.common.businessentities.VmDevice vmDevice , java.util.Map < java.lang.String , java.lang.Object > struct ) { struct.put ( VdsProperties.Type , vmDevice.getType ( ) . getValue ( ) ) ; struct.put ( VdsProperties.Device , vmDevice.getDevice ( ) ) ; struct.put ( VdsProperties.Index , "0" ) ; struct.put ( VdsProperties.INTERFACE , VdsProperties.Fdc ) ; struct.put ( VdsProperties.ReadOnly , java.lang.String.valueOf ( vmDevice.getIsReadOnly ( ) ) ) ; struct.put ( VdsProperties.Shareable , java.lang.Boolean.FALSE.toString ( ) ) ; }
Source:
public java.util.ArrayList < org.ovirt.engine.core.common.action.VdcReturnValueBase > execute ( ) { for ( org.ovirt.engine.core.common.action.VdcActionParametersBase parameter : parameters ) { org.ovirt.engine.core.bll.CommandBase < ? > command = commandFactory.createWrappedCommand ( commandContext , actionType , parameter , isInternal ) ; commandFactory.prepareCommandForMonitoring ( commandContext , command ) ; returnValues.add ( command.executeAction ( ) ) ; } return returnValues ; }

Target:
public java.util.ArrayList < org.ovirt.engine.core.common.action.VdcReturnValueBase > execute ( ) { for ( org.ovirt.engine.core.common.action.VdcActionParametersBase parameter : parameters ) { if ( ! ( isInternal ) ) { logExecution ( org.ovirt.engine.core.bll.SequentialMultipleActionsRunner.log , sessionDataContainer , parameter.getSessionId ( ) , java.lang.String.format ( "command %s" , actionType ) ) ; } org.ovirt.engine.core.bll.CommandBase < ? > command = commandFactory.createWrappedCommand ( commandContext , actionType , parameter , isInternal ) ; commandFactory.prepareCommandForMonitoring ( commandContext , command ) ; returnValues.add ( command.executeAction ( ) ) ; } return returnValues ; }
Source:
public void updateAuditLogEventProcessed ( long auditLogId ) throws java.sql.SQLException { java.sql.Connection connection = null ; java.sql.PreparedStatement ps = null ; try { connection = ds.getConnection ( ) ; ps = connection.prepareStatement ( ( "UPDATE audit_log " + ( "SET processed = 'true' " + "WHERE audit_log_id = ? ;" ) ) ) ; ps.setLong ( 1 , auditLogId ) ; int updated = ps.executeUpdate ( ) ; if ( updated != 1 ) { org.ovirt.engine.core.notifier.dao.EventsManager.log.error ( "Failed to mark audit_log entry as processed for audit_log_id: {}" , auditLogId ) ; } } finally { org.ovirt.engine.core.utils.db.DbUtils.closeQuietly ( ps , connection ) ; } }

Target:
public void updateAuditLogEventProcessed ( long auditLogId ) throws java.sql.SQLException { java.sql.Connection connection = null ; java.sql.PreparedStatement ps = null ; try { connection = ds.getConnection ( ) ; ps = connection.prepareStatement ( ( "" + ( ( "UPDATE audit_log " + "SET processed = 'true' " ) + "WHERE audit_log_id = ? ;" ) ) ) ; ps.setLong ( 1 , auditLogId ) ; int updated = ps.executeUpdate ( ) ; if ( updated != 1 ) { org.ovirt.engine.core.notifier.dao.EventsManager.log.error ( "Failed to mark audit_log entry as processed for audit_log_id: {}" , auditLogId ) ; } } finally { org.ovirt.engine.core.utils.db.DbUtils.closeQuietly ( ps , connection ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.network.Network getNetworkById ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks ) { return org.ovirt.engine.core.utils.linq.LinqUtils.firstOrNull ( networks , new org.ovirt.engine.core.utils.linq.Predicate < org.ovirt.engine.core.common.businessentities.network.Network > ( ) { @ java.lang.Override public boolean eval ( org.ovirt.engine.core.common.businessentities.network.Network network ) { return network.getId ( ) . equals ( getNetwork ( ) . getId ( ) ) ; } } ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.Network getNetworkById ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks ) { org.ovirt.engine.core.compat.Guid networkId = org.ovirt.engine.core.bll.network.dc.UpdateNetworkCommand.getNetwork ( ) . getId ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.Network network : networks ) { if ( network.getId ( ) . equals ( networkId ) ) { return network ; } } return null ; }
Source:
public static void getGlusterHostsNewlyAdded ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId , boolean isFingerprintRequired ) { 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.RunQuery ( VdcQueryType.GetAddedGlusterServers , new org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters ( clusterId , isFingerprintRequired ) , aQuery ) ; }

Target:
public static void getTemplateById ( 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 ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmTemplate , new org.ovirt.engine.core.common.queries.GetVmTemplateParameters ( templateId ) , aQuery ) ; }
Source:
public void init ( ) throws javax.servlet.ServletException { setVerifyHost ( getConfigBoolean ( org.ovirt.engine.core.services.ProxyServlet.VERIFY_HOST_PRM ) ) ; setVerifyChain ( getConfigBoolean ( org.ovirt.engine.core.services.ProxyServlet.VERIFY_CHAIN_PRM ) ) ; setHttpsProtocol ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.HTTPS_PROTOCOL_PRM ) ) ; setTrustManagerAlgorithm ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.TRUST_MANAGER_ALGORITHM_PRM ) ) ; setTrustStore ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.TRUST_STORE_PRM ) ) ; setTrustStoreType ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.TRUST_STORE_TYPE_PRM ) ) ; setTrustStorePassword ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.TRUST_STORE_PASSWORD_PRM ) ) ; setReadTimeout ( getConfigInteger ( org.ovirt.engine.core.services.ProxyServlet.READ_TIMEOUT_PRM ) ) ; setUrl ( getConfigString ( org.ovirt.engine.core.services.ProxyServlet.URL_PRM ) ) ; }

Target:
private java.lang.String getUrl ( ) { java.lang.String url = getConfigString ( org.ovirt.engine.core.services.ProxyServlet.URL_PRM ) ; if ( ( ! ( url.startsWith ( org.ovirt.engine.core.services.ProxyServlet.HTTP ) ) ) && ( ! ( url.startsWith ( org.ovirt.engine.core.services.ProxyServlet.HTTPS ) ) ) ) { url = null ; } return url ; }
Source:
public void testRemove ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( 2 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.RemoveNetwork , org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters.class , new java.lang.String [ ] { "StoragePoolId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendDataCenterNetworksResourceTest.DATA_CENTER_ID } , true , true ) ) ; verifyRemove ( collection.remove ( GUIDS [ 0 ] . toString ( ) ) ) ; }

Target:
public void testRemove ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( 2 ) ; setUriInfo ( setUpActionExpectations ( VdcActionType.RemoveNetwork , org.ovirt.engine.core.common.action.RemoveNetworkParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , true , true ) ) ; verifyRemove ( collection.remove ( GUIDS [ 0 ] . toString ( ) ) ) ; }
Source:
public static void getDataCentersByStorageDomain ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid storageDomainId ) { 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.StoragePool > ) ( source ) ) : null ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetStoragePoolsByStorageDomainId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( storageDomainId ) , aQuery ) ; }

Target:
public static void getRpmVersion ( 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.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.ProductRPMVersion ) ; tempVar.setVersion ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( tempVar , aQuery ) ; }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel vmGuideModel = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > nics = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ) ( returnValue ) ) ; vmGuideModel.nics = nics ; vmGuideModel.UpdateOptionsPostData ( ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel vmGuideModel = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > nics = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ) ( returnValue ) ) ; vmGuideModel.nics = nics ; vmGuideModel.updateOptionsPostData ( ) ; }
Source:
public boolean handlesEvent ( com.google.gwt.view.client.CellPreviewEvent < org.ovirt.engine.ui.uicommonweb.models.EntityModel > event ) { com.google.gwt.dom.client.NativeEvent nativeEvent = event.getNativeEvent ( ) ; if ( ! ( BrowserEvents.CLICK.equals ( nativeEvent.getType ( ) ) ) ) { return false ; } com.google.gwt.dom.client.Element target = nativeEvent.getEventTarget ( ) . cast ( ) ; java.lang.String tagName = target.getTagName ( ) . toLowerCase ( ) ; return ( "select" . equals ( tagName ) ) || ( "option" . equals ( tagName ) ) ; }

Target:
public java.util.Set < java.lang.String > getConsumedEvents ( ) { java.util.Set < java.lang.String > set = new java.util.HashSet ( super . getConsumedEvents ( ) ) ; set.add ( BrowserEvents.CHANGE ) ; return set ; }
Source:
public org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeSnapshotConfigReturnForXmlRpc glusterVolumeSnapshotConfigGet ( org.ovirt.engine.core.compat.Guid clusterId , java.lang.String volumeName ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "GlusterSnapshot.configList" ) . withOptionalParameter ( "volumeName" , volumeName ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withIgnoreResponseKey ( ) ; return new org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeSnapshotConfigReturnForXmlRpc ( clusterId , response ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeSnapshotCreateReturnForXmlRpc glusterSnapshotCreate ( java.lang.String volumeName , java.lang.String snapshotName , java.lang.String description , boolean force ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "GlusterVolume.snapshotCreate" ) . withParameter ( "volumeName" , volumeName ) . withParameter ( "snapName" , snapshotName ) . withOptionalParameter ( "snapDescription" , description ) . withParameter ( "force" , force ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) . withIgnoreResponseKey ( ) ; return new org.ovirt.engine.core.vdsbroker.gluster.GlusterVolumeSnapshotCreateReturnForXmlRpc ( response ) ; }
Source:
protected boolean updateVnicForBackwardCompatibility ( ) { org.ovirt.engine.core.bll.network.VmInterfaceManager nicManager = new org.ovirt.engine.core.bll.network.VmInterfaceManager ( ) ; if ( ! ( validate ( nicManager.updateNicForBackwardCompatibility ( org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getParameters ( ) . getInterface ( ) , org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getVm ( ) . getStaticData ( ) , org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getCurrentUser ( ) . getUserId ( ) ) ) ) ) { return false ; } return true ; }

Target:
protected boolean updateVnicForBackwardCompatibility ( ) { if ( ! ( validate ( org.ovirt.engine.core.bll.network.vm.VnicProfileHelper.updateNicForBackwardCompatibility ( org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getParameters ( ) . getInterface ( ) , org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getVm ( ) . getStaticData ( ) , org.ovirt.engine.core.bll.network.vm.AbstractVmInterfaceCommand.getCurrentUser ( ) . getUserId ( ) ) ) ) ) { return false ; } return true ; }
Source:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.errors.EngineMessage engineMessage = org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ; org.ovirt.engine.core.bll.ValidationResult slavesValidationResult = new org.ovirt.engine.core.bll.ValidationResult ( engineMessage , org.ovirt.engine.core.utils.ReplacementUtils.getVariableAssignmentString ( engineMessage , "slaveA" ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.VAR_NETWORK_NAME , "networkName" ) ) ; org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; doTestValidModifiedBonds ( bond , ValidationResult.VALID , slavesValidationResult , slavesValidationResult ) ; }

Target:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.errors.EngineMessage engineMessage = org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ; org.ovirt.engine.core.bll.ValidationResult slavesValidationResult = new org.ovirt.engine.core.bll.ValidationResult ( engineMessage , org.ovirt.engine.core.utils.ReplacementUtils.getVariableAssignmentString ( engineMessage , "slaveA" ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.VAR_NETWORK_NAME , "networkName" ) ) ; org.ovirt.engine.core.common.action.CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBondWithNameAndId ( ) ; createOrUpdateBond.setSlaves ( java.util.stream.Stream.of ( "slaveA" , "slaveB" ) . collect ( java.util.stream.Collectors.toSet ( ) ) ) ; doTestValidModifiedBonds ( createOrUpdateBond , ValidationResult.VALID , slavesValidationResult , slavesValidationResult ) ; }
Source:
private void UpdateCanSpecify ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = ( ( org.ovirt.engine.core.common.businessentities.network.Network ) ( getNetwork ( ) . getSelectedItem ( ) ) ) ; boolean isChangable = ( bootProtocolsAvailable ) && ( getIsStaticAddress ( ) ) ; getAddress ( ) . setIsChangable ( isChangable ) ; getSubnet ( ) . setIsChangable ( isChangable ) ; }

Target:
private void updateCanSpecify ( ) { org.ovirt.engine.core.common.businessentities.network.Network network = ( ( org.ovirt.engine.core.common.businessentities.network.Network ) ( getNetwork ( ) . getSelectedItem ( ) ) ) ; boolean isChangable = ( bootProtocolsAvailable ) && ( getIsStaticAddress ( ) ) ; getAddress ( ) . setIsChangable ( isChangable ) ; getSubnet ( ) . setIsChangable ( isChangable ) ; }
Source:
protected void initResource ( org.ovirt.engine.api.restapi.resource.AbstractBackendResource < R , Q > resource ) { resource.setBackend ( backend ) ; resource.setMappingLocator ( mapperLocator ) ; resource.setValidatorLocator ( validatorLocator ) ; resource.setSessionHelper ( sessionHelper ) ; resource.setMessageBundle ( messageBundle ) ; resource.setHttpHeaders ( httpHeaders ) ; }

Target:
protected void initResource ( org.ovirt.engine.api.restapi.resource.AbstractBackendResource < R , Q > resource ) { resource.setMappingLocator ( mapperLocator ) ; initBackendResource ( resource ) ; }
Source:
private void setCustomDefinedProperties ( org.ovirt.engine.core.common.businessentities.VmStatic vmStaticDataFromParams ) { org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils.VMCustomProperties properties = org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils.getInstance ( ) . parseProperties ( org.ovirt.engine.core.bll.UpdateVmCommand.getVdsGroup ( ) . getcompatibility_version ( ) , vmStaticDataFromParams.getCustomProperties ( ) ) ; vmStaticDataFromParams.setPredefinedProperties ( properties.getPredefinedProperties ( ) ) ; vmStaticDataFromParams.setUserDefinedProperties ( properties.getUseDefinedProperties ( ) ) ; }

Target:
private org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils getVmPropertiesUtils ( ) { return org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils.getInstance ( ) ; }
Source:
public void validateCantUploadDiskAttached ( ) { initializeSuppliedImage ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_DISK_ATTACHED_TO_VMS , "" ) ) . when ( diskValidator ) . isDiskPluggedToAnyNonDownVm ( ) ; getCommand ( ) . validate ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.assertValidationMessages ( "Can't start a transfer for an image that is attached to any VMs." , getCommand ( ) , EngineMessage.ACTION_TYPE_FAILED_DISK_ATTACHED_TO_VMS ) ; }

Target:
public void validateCantUploadDiskAttached ( ) { initializeSuppliedImage ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_DISK_PLUGGED_TO_NON_DOWN_VMS , "" ) ) . when ( diskValidator ) . isDiskPluggedToAnyNonDownVm ( false ) ; getCommand ( ) . validate ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.assertValidationMessages ( "Can't start a transfer for an image that is attached to any VMs." , getCommand ( ) , EngineMessage.ACTION_TYPE_FAILED_DISK_PLUGGED_TO_NON_DOWN_VMS ) ; }
Source:
private void validateInterfacesExist ( ) { for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface : params.getInterfaces ( ) ) { updateBaseInterface ( iface ) ; java.lang.String nameWithoutVlanId = org.ovirt.engine.core.utils.NetworkUtils.stripVlan ( iface ) ; if ( ( ! ( getExistingIfaces ( ) . containsKey ( nameWithoutVlanId ) ) ) && ( ! ( bonds.containsKey ( nameWithoutVlanId ) ) ) ) { addViolation ( VdcBllMessages.NETWORK_INTERFACES_DONT_EXIST , nameWithoutVlanId ) ; } } }

Target:
private void validateNicForNotRemovingLabeledNetworks ( java.lang.String network , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic ) { org.ovirt.engine.core.common.businessentities.network.Network removedNetwork = getExistingClusterNetworks ( ) . get ( network ) ; if ( ( ( org.ovirt.engine.core.utils.NetworkUtils.isLabeled ( nic ) ) && ( removedNetwork != null ) ) && ( nic.getLabels ( ) . contains ( removedNetwork.getLabel ( ) ) ) ) { addViolation ( EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_LABELED_NETWORK_FROM_NIC , network ) ; } }
Source:
public static org.ovirt.engine.core.bll.ValidationResult canRunActionOnNonManagedVm ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.common.action.VdcActionType actionType ) { org.ovirt.engine.core.bll.ValidationResult validationResult = ValidationResult.VALID ; if ( ( ( vm.isHostedEngine ( ) ) && ( ! ( org.ovirt.engine.core.bll.VmHandler.COMMANDS_ALLOWED_ON_HOSTED_ENGINE.contains ( actionType ) ) ) ) || ( ( vm.isExternalVm ( ) ) && ( ! ( org.ovirt.engine.core.bll.VmHandler.COMMANDS_ALLOWED_ON_EXTERNAL_VMS.contains ( actionType ) ) ) ) ) { validationResult = new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM ) ; } return validationResult ; }

Target:
public static org.ovirt.engine.core.bll.ValidationResult canRunActionOnNonManagedVm ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.common.action.VdcActionType actionType ) { org.ovirt.engine.core.bll.ValidationResult validationResult = ValidationResult.VALID ; if ( ! ( org.ovirt.engine.core.common.validation.VmActionByVmOriginTypeValidator.isCommandAllowed ( vm , actionType ) ) ) { validationResult = new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM ) ; } return validationResult ; }