auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testReadAllText ( ) throws java.lang.Exception { java.io.File iFile = java.io.File.createTempFile ( "Test" , ".txt" ) ; java.io.FileWriter iFileWriter = new java.io.FileWriter ( iFile ) ; iFileWriter.write ( "This is a test" ) ; iFileWriter.close ( ) ; java.lang.String data = org.ovirt.engine.core.utils.FileUtil.readAllText ( iFile.getAbsolutePath ( ) ) ; org.junit.Assert.assertEquals ( "Data should be equal" , "This is a test" , data ) ; }

Target:
public void testReadAllText ( ) throws java.lang.Exception { java.io.File iFile = java.io.File.createTempFile ( "Test" , ".txt" ) ; try ( java.io.FileWriter iFileWriter = new java.io.FileWriter ( iFile ) ) { iFileWriter.write ( "This is a test" ) ; } java.lang.String data = org.ovirt.engine.core.utils.FileUtil.readAllText ( iFile.getAbsolutePath ( ) ) ; org.junit.Assert.assertEquals ( "Data should be equal" , "This is a test" , data ) ; }
Source:
public void setUp ( ) { org.mockito.Mockito.doReturn ( vdsSpmIdMapDao ) . when ( cmd ) . getVdsSpmIdMapDao ( ) ; spId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; vdsId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setId ( vdsId ) ; vds.setStoragePoolId ( spId ) ; cmd.setVds ( vds ) ; }

Target:
public void setUp ( ) { spId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; vdsId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setId ( vdsId ) ; vds.setStoragePoolId ( spId ) ; cmd.setVds ( vds ) ; }
Source:
protected void setUpLogExpectations ( boolean debug ) { try { java.lang.reflect.Field field = org.ovirt.engine.api.restapi.resource.BaseBackendResource.class . getDeclaredField ( "log" ) ; org.slf4j.Logger logger = org.mockito.Mockito.mock ( org.slf4j.Logger.class ) ; org.mockito.Mockito.when ( logger.isDebugEnabled ( ) ) . thenReturn ( debug ) ; setFinalStatic ( field , logger ) ; } catch ( java.lang.Exception e ) { e.printStackTrace ( ) ; } }

Target:
protected void setUpLogExpectations ( boolean debug ) throws java.lang.Exception { java.lang.reflect.Field field = org.ovirt.engine.api.restapi.resource.BaseBackendResource.class . getDeclaredField ( "log" ) ; org.slf4j.Logger logger = org.mockito.Mockito.mock ( org.slf4j.Logger.class ) ; org.mockito.Mockito.when ( logger.isDebugEnabled ( ) ) . thenReturn ( debug ) ; setFinalStatic ( field , logger ) ; }
Source:
protected org.ovirt.engine.core.bll.ValidationResult macAvailable ( ) { java.lang.Boolean allowDupMacs = org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > GetValue ( ConfigValues.AllowDuplicateMacAddresses ) ; return ( org.ovirt.engine.core.bll.network.MacPoolManager.getInstance ( ) . isMacInUse ( getMacAddress ( ) ) ) && ( ! allowDupMacs ) ? new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.NETWORK_MAC_ADDRESS_IN_USE ) : org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
protected org.ovirt.engine.core.bll.ValidationResult macAvailable ( ) { java.lang.Boolean allowDupMacs = org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.AllowDuplicateMacAddresses ) ; return ( org.ovirt.engine.core.bll.network.MacPoolManager.getInstance ( ) . isMacInUse ( getMacAddress ( ) ) ) && ( ! allowDupMacs ) ? new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.NETWORK_MAC_ADDRESS_IN_USE ) : org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private void doQueryExecute ( org.ovirt.engine.api.extensions.ExtMap input , org.ovirt.engine.api.extensions.ExtMap output ) throws java.sql.SQLException { output.mput ( Authz.InvokeKeys.QUERY_RESULT , authorization.executeQuery ( input.get ( Authz.InvokeKeys.QUERY_OPAQUE , java.lang.String.class ) , input.get ( Authz.InvokeKeys.PAGE_SIZE , java.lang.Integer.class , java.lang.Integer.MAX_VALUE ) ) ) . mput ( Base.InvokeKeys.RESULT , Base.InvokeResult.SUCCESS ) . mput ( Authz.InvokeKeys.STATUS , Authz.Status.SUCCESS ) ; }

Target:
private void doQueryExecute ( org.ovirt.engine.api.extensions.ExtMap input , org.ovirt.engine.api.extensions.ExtMap output ) throws java.sql.SQLException { output.mput ( Authz.InvokeKeys.QUERY_RESULT , authorization.executeQuery ( input.get ( Authz.InvokeKeys.QUERY_OPAQUE , java.lang.String.class ) , input.get ( Authz.InvokeKeys.PAGE_SIZE , java.lang.Integer.class , java.lang.Integer.MAX_VALUE ) ) ) ; }
Source:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Cluster cluster ) { validateParameters ( cluster , "name" , "dataCenter.name|id" ) ; validateEnums ( org.ovirt.engine.api.model.Cluster.class , cluster ) ; org.ovirt.engine.core.common.businessentities.StoragePool pool = org.ovirt.engine.api.restapi.resource.BackendDataCenterResource.getStoragePool ( cluster.getDataCenter ( ) , this ) ; org.ovirt.engine.core.common.businessentities.VDSGroup entity = map ( cluster , map ( pool ) ) ; return performCreate ( VdcActionType.AddVdsGroup , new org.ovirt.engine.core.common.action.AddClusterOperationParameters ( entity ) , new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.VdcQueryType.GetVdsGroupById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ) ; }

Target:
protected org.ovirt.engine.core.common.businessentities.StoragePool getDataCenter ( org.ovirt.engine.api.model.Cluster cluster ) { return org.ovirt.engine.api.restapi.resource.BackendDataCenterResource.getStoragePool ( cluster.getDataCenter ( ) , this ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlan ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.network.Network net ) { return createVdsInterface ( ( ( ( iface.getName ( ) ) + "." ) + ( net.getVlanId ( ) ) ) , false , null , null , NetworkBootProtocol.NONE , net.getName ( ) , net.getVlanId ( ) ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlan ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.core.common.businessentities.network.Network net ) { return createVdsInterface ( ( ( ( iface.getName ( ) ) + "." ) + ( net.getVlanId ( ) ) ) , false , null , null , NetworkBootProtocol.NONE , net.getName ( ) , iface.getName ( ) , net.getVlanId ( ) ) ; }
Source:
void addSelectedItemChangeHandler ( ) { selectedItemChangeListener = new org.ovirt.engine.ui.uicompat.IEventListener ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { if ( ! ( sameEntity ( listModel.getSelectedItem ( ) , model ) ) ) { getView ( ) . setNotSelected ( model.isVmUp ( ) ) ; } else { getView ( ) . setSelected ( ) ; } } } ; listModel.getSelectedItemChangedEvent ( ) . addListener ( selectedItemChangeListener ) ; }

Target:
void addSelectedItemChangeHandler ( ) { selectedItemChangeListener = new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { if ( ! ( sameEntity ( listModel.getSelectedItem ( ) , model ) ) ) { getView ( ) . setNotSelected ( model.isVmUp ( ) ) ; } else { getView ( ) . setSelected ( ) ; } } } ; listModel.getSelectedItemChangedEvent ( ) . addListener ( selectedItemChangeListener ) ; }
Source:
public void migrateVM ( java.util.List < org.ovirt.engine.core.compat.Guid > initialHosts , org.ovirt.engine.core.compat.Guid vmToMigrate ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vmToMigrate ) ; parameters.setInitialHosts ( new java.util.ArrayList < org.ovirt.engine.core.compat.Guid > ( initialHosts ) ) ; backendInternal.runInternalAction ( VdcActionType.MigrateVm , parameters , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }

Target:
public void migrateVM ( java.util.List < org.ovirt.engine.core.compat.Guid > initialHosts , org.ovirt.engine.core.compat.Guid vmToMigrate ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vmToMigrate ) ; parameters.setInitialHosts ( new java.util.ArrayList ( initialHosts ) ) ; backendInternal.runInternalAction ( VdcActionType.MigrateVm , parameters , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { java.util.Map < java.lang.Integer , java.util.Map < org.ovirt.engine.core.compat.Version , java.util.List < org.ovirt.engine.core.common.businessentities.DisplayType > > > result = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.displayTypes = new org.ovirt.engine.ui.uicommonweb.MapWithDefaults < java.lang.Integer , java.util.Map < org.ovirt.engine.core.compat.Version , java.util.List < org.ovirt.engine.core.common.businessentities.DisplayType > > > ( result , result.get ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.DEFAULT_OS_ID ) ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.displayTypes = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; }
Source:
public static org.ovirt.engine.core.common.vdscommands.VDSReturnValue handleVdsResult ( org.ovirt.engine.core.common.vdscommands.VDSReturnValue result ) { if ( org.apache.commons.lang.StringUtils.isNotEmpty ( result.getExceptionString ( ) ) ) { org.ovirt.engine.core.common.errors.VdcBLLException exp ; if ( ( result.getVdsError ( ) ) != null ) { exp = new org.ovirt.engine.core.common.errors.VdcBLLException ( result.getVdsError ( ) . getCode ( ) , result.getExceptionString ( ) ) ; } else { exp = new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.ENGINE , result.getExceptionString ( ) ) ; } throw exp ; } return result ; }

Target:
public static org.ovirt.engine.core.common.vdscommands.VDSReturnValue handleVdsResult ( org.ovirt.engine.core.common.vdscommands.VDSReturnValue result ) { if ( org.apache.commons.lang.StringUtils.isNotEmpty ( result.getExceptionString ( ) ) ) { throw new org.ovirt.engine.core.common.errors.VdcBLLException ( ( ( result.getVdsError ( ) ) != null ? result.getVdsError ( ) . getCode ( ) : org.ovirt.engine.core.common.errors.VdcBllErrors.ENGINE ) , result.getExceptionString ( ) ) ; } return result ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; params = getQueryParameters ( ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmDao ( ) ) . thenReturn ( vmDao ) ; org.mockito.Mockito.when ( params.getStorageDomainId ( ) ) . thenReturn ( domainId ) ; query = getQuery ( ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; params = getQueryParameters ( ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmDao ( ) ) . thenReturn ( vmDao ) ; org.mockito.Mockito.when ( params.getId ( ) ) . thenReturn ( domainId ) ; query = getQuery ( ) ; }
Source:
public void testConfiguration ( ) { org.ovirt.engine.core.notifier.utils.NotificationConfigurator configurator = null ; try { configurator = new org.ovirt.engine.core.notifier.utils.NotificationConfigurator ( "src/test/resources/conf/notifier.conf" ) ; } catch ( org.ovirt.engine.core.notifier.NotificationServiceException e ) { e.printStackTrace ( ) ; } org.junit.Assert.assertNotNull ( configurator ) ; long timerInterval = - 1 ; try { timerInterval = configurator.getTimerInterval ( NotificationProperties.INTERVAL_IN_SECONDS , 10 ) ; } catch ( org.ovirt.engine.core.notifier.NotificationServiceException e ) { } org.junit.Assert.assertEquals ( timerInterval , 60 ) ; }

Target:
public void testConfiguration ( ) { org.ovirt.engine.core.notifier.utils.NotificationConfigurator configurator = null ; configurator = new org.ovirt.engine.core.notifier.utils.NotificationConfigurator ( ) ; org.junit.Assert.assertNotNull ( configurator ) ; long timerInterval = - 1 ; try { timerInterval = configurator.getTimerInterval ( NotificationProperties.INTERVAL_IN_SECONDS , 10 ) ; } catch ( org.ovirt.engine.core.notifier.NotificationServiceException e ) { } org.junit.Assert.assertEquals ( timerInterval , 60 ) ; }
Source:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { switch ( org.ovirt.engine.core.bll.AddVmCommand.getActionState ( ) ) { case EXECUTE : return org.ovirt.engine.core.bll.AddVmCommand.getSucceeded ( ) ? ( org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getVdsmTaskIdList ( ) . size ( ) ) > 0 ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_STARTED : org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM : org.ovirt.engine.core.common.AuditLogType.USER_FAILED_ADD_VM ; case END_SUCCESS : return org.ovirt.engine.core.bll.AddVmCommand.getSucceeded ( ) ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_SUCCESS : org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_FAILURE ; default : return org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_FAILURE ; } }

Target:
public org.ovirt.engine.core.common.AuditLogType getAuditLogTypeValue ( ) { switch ( org.ovirt.engine.core.bll.AddVmCommand.getActionState ( ) ) { case EXECUTE : return org.ovirt.engine.core.bll.AddVmCommand.getSucceeded ( ) ? ! ( org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getVdsmTaskIdList ( ) . isEmpty ( ) ) ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_STARTED : org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM : org.ovirt.engine.core.common.AuditLogType.USER_FAILED_ADD_VM ; case END_SUCCESS : return org.ovirt.engine.core.bll.AddVmCommand.getSucceeded ( ) ? org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_SUCCESS : org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_FAILURE ; default : return org.ovirt.engine.core.common.AuditLogType.USER_ADD_VM_FINISHED_FAILURE ; } }
Source:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.UpdateGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters ( HOOK_ID ) , null ) ) ; setUpMocksForUpdate ( ) ; mockBackend ( true , null ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.times ( 1 ) ) . updateGlusterHook ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity.class ) ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_UPDATED ) ; }

Target:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.UpdateGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters ( HOOK_ID ) , null ) ) ; setUpMocksForUpdate ( ) ; mockBackend ( true , null ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( hooksDao , org.mockito.Mockito.times ( 1 ) ) . updateGlusterHook ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity.class ) ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_UPDATED , cmd.getAuditLogTypeValue ( ) ) ; }
Source:
public void testVmInPreview ( ) { setUpGeneralValidations ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ) . when ( snapshotsValidator ) . vmNotInPreview ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW.name ( ) ) ) ; }

Target:
public void testVmInPreview ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ) . when ( snapshotsValidator ) . vmNotInPreview ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.snapshots.CreateAllSnapshotsFromVmCommandTest.getEmptyDiskList ( ) ) . when ( cmd ) . getDisksList ( ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW.name ( ) ) ) ; }
Source:
protected void endWithFailure ( ) { super . endActionOnDisks ( ) ; if ( ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) ) != null ) { removeVmInSpm ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) . getstorage_pool_id ( ) , org.ovirt.engine.core.bll.AddVmCommand.getVmId ( ) ) ; } removeVmRelatedEntitiesFromDb ( ) ; org.ovirt.engine.core.bll.AddVmCommand.setSucceeded ( true ) ; }

Target:
protected void endWithFailure ( ) { super . endActionOnDisks ( ) ; removeVmRelatedEntitiesFromDb ( ) ; org.ovirt.engine.core.bll.AddVmCommand.setSucceeded ( true ) ; }
Source:
protected void AddStoragePoolToDb ( ) { org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) . setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) . setstatus ( StoragePoolStatus.Uninitialized ) ; org.ovirt.engine.core.common.businessentities.Quota defaultStoragePoolQuota = generateQuotaForNewStoragePool ( ) ; org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePoolDAO ( ) . save ( org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) ) ; getQuotaHelper ( ) . saveQuotaForUser ( defaultStoragePoolQuota , MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID ) ; }

Target:
protected void AddStoragePoolToDb ( ) { org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) . setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) . setstatus ( StoragePoolStatus.Uninitialized ) ; org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePoolDAO ( ) . save ( org.ovirt.engine.core.bll.storage.AddEmptyStoragePoolCommand.getStoragePool ( ) ) ; }
Source:
public void testUpdateAll ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.VmDynamic existingVm2 = dao.get ( new org.ovirt.engine.core.compat.Guid ( "77296e00-0cad-4e5a-9299-008a7b6f4356" ) ) ; existingVm.setStatus ( VMStatus.Down ) ; existingVm2.setVmIp ( "111" ) ; existingVm2.setVmFQDN ( "localhost.localdomain" ) ; dao.updateAll ( java.util.Arrays.asList ( new org.ovirt.engine.core.common.businessentities.VmDynamic [ ] { existingVm , existingVm2 } ) ) ; org.junit.Assert.assertEquals ( existingVm , dao.get ( existingVm.getId ( ) ) ) ; org.junit.Assert.assertEquals ( existingVm2 , dao.get ( existingVm2.getId ( ) ) ) ; }

Target:
public void testUpdateAll ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.VmDynamic existingVm2 = dao.get ( new org.ovirt.engine.core.compat.Guid ( "77296e00-0cad-4e5a-9299-008a7b6f4356" ) ) ; existingVm.setStatus ( VMStatus.Down ) ; existingVm2.setVmIp ( "111" ) ; existingVm2.setVmFQDN ( "localhost.localdomain" ) ; dao.updateAll ( java.util.Arrays.asList ( existingVm , existingVm2 ) ) ; org.junit.Assert.assertEquals ( existingVm , dao.get ( existingVm.getId ( ) ) ) ; org.junit.Assert.assertEquals ( existingVm2 , dao.get ( existingVm2.getId ( ) ) ) ; }
Source:
private void logMessage ( org.ovirt.engine.core.common.businessentities.AuditLog auditLog ) { java.lang.String logMessage = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.getMessageToLog ( auditLog ) ; switch ( auditLog.getSeverity ( ) ) { case NORMAL : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.info ( logMessage ) ; break ; case ERROR : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.error ( logMessage ) ; break ; case ALERT : case WARNING : default : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warn ( logMessage ) ; break ; } }

Target:
private void logMessage ( org.ovirt.engine.core.common.businessentities.AuditLog auditLog ) { java.lang.String logMessage = getMessageToLog ( auditLog ) ; switch ( auditLog.getSeverity ( ) ) { case NORMAL : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.info ( logMessage ) ; break ; case ERROR : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.error ( logMessage ) ; break ; case ALERT : case WARNING : default : org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warn ( logMessage ) ; break ; } }
Source:
public static < TSource > java.util.Collection < TSource > where ( java.util.Collection < TSource > source , org.ovirt.engine.ui.uicommonweb.Linq.IPredicate < ? super TSource > predicate ) { java.util.ArrayList < TSource > list = new java.util.ArrayList < > ( ) ; for ( TSource item : source ) { if ( predicate.match ( item ) ) { list.add ( item ) ; } } return list ; }

Target:
public static < TSource > java.util.Collection < TSource > where ( java.util.Collection < TSource > source , org.ovirt.engine.ui.uicommonweb.Linq.IPredicate < ? super TSource > predicate ) { java.util.List < TSource > list = new java.util.ArrayList < > ( ) ; for ( TSource item : source ) { if ( predicate.match ( item ) ) { list.add ( item ) ; } } return list ; }
Source:
public boolean isValidVmNetwork ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface iface , java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > networksByName ) { java.lang.String networkName = iface.getNetworkName ( ) ; return ( networkName == null ) || ( ( networksByName.containsKey ( networkName ) ) && ( networksByName.get ( networkName ) . isVmNetwork ( ) ) ) ; }

Target:
public boolean isValidVmNetwork ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface iface , java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > networksByName , org.ovirt.engine.core.compat.Version version ) { java.lang.String networkName = iface.getNetworkName ( ) ; return ( networkName == null ) || ( ( networksByName.containsKey ( networkName ) ) && ( networksByName.get ( networkName ) . isVmNetwork ( ) ) ) ; }
Source:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assert query.equals ( "" ) ; setUpEntityQueryExpectations ( VdcQueryType.GetAllStorageServerConnections , org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , setUpStorageConnections ( ) , failure ) ; control.replay ( ) ; }

Target:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assertEquals ( "" , query ) ; setUpEntityQueryExpectations ( VdcQueryType.GetAllStorageServerConnections , org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class , new java.lang.String [ ] { } , new java.lang.Object [ ] { } , setUpStorageConnections ( ) , failure ) ; control.replay ( ) ; }
Source:
public void onFailure ( java.lang.Throwable caught ) { if ( org.ovirt.engine.ui.frontend.Frontend.ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to execute RunQuery: " + caught ) , caught ) ; org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) . runQueryFailed ( null ) ; org.ovirt.engine.ui.frontend.Frontend.failureEventHandler ( caught ) ; if ( callback.isHandleFailure ( ) ) { org.ovirt.engine.ui.frontend.Frontend.setLoggedInUser ( null ) ; callback.asyncCallback.OnSuccess ( callback.getModel ( ) , null ) ; } }

Target:
public void onFailure ( java.lang.Throwable caught ) { if ( org.ovirt.engine.ui.frontend.Frontend.ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to execute RunQuery: " + caught ) , caught ) ; org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) . runQueryFailed ( null ) ; org.ovirt.engine.ui.frontend.Frontend.failureEventHandler ( caught ) ; if ( callback.isHandleFailure ( ) ) { org.ovirt.engine.ui.frontend.Frontend.setLoggedInUser ( null ) ; callback.asyncCallback.onSuccess ( callback.getModel ( ) , null ) ; } }
Source:
private void executeFenceVdsManuallyAction ( final org.ovirt.engine.core.compat.Guid vdsId , java.lang.String sessionId ) { org.ovirt.engine.core.common.action.FenceVdsManualyParameters fenceVdsManuallyParams = new org.ovirt.engine.core.common.action.FenceVdsManualyParameters ( false ) ; fenceVdsManuallyParams.setStoragePoolId ( org.ovirt.engine.core.bll.RestartVdsCommand.getVds ( ) . getStoragePoolId ( ) ) ; fenceVdsManuallyParams.setVdsId ( vdsId ) ; fenceVdsManuallyParams.setSessionId ( sessionId ) ; fenceVdsManuallyParams.setParentCommand ( VdcActionType.RestartVds ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.FenceVdsManualy , fenceVdsManuallyParams , getContext ( ) ) ; }

Target:
private void executeFenceVdsManuallyAction ( final org.ovirt.engine.core.compat.Guid vdsId , java.lang.String sessionId ) { org.ovirt.engine.core.common.action.FenceVdsManualyParameters fenceVdsManuallyParams = new org.ovirt.engine.core.common.action.FenceVdsManualyParameters ( false ) ; fenceVdsManuallyParams.setStoragePoolId ( org.ovirt.engine.core.bll.RestartVdsCommand.getVds ( ) . getStoragePoolId ( ) ) ; fenceVdsManuallyParams.setVdsId ( vdsId ) ; fenceVdsManuallyParams.setSessionId ( sessionId ) ; fenceVdsManuallyParams.setParentCommand ( VdcActionType.RestartVds ) ; runInternalAction ( VdcActionType.FenceVdsManualy , fenceVdsManuallyParams , org.ovirt.engine.core.bll.RestartVdsCommand.getContext ( ) ) ; }
Source:
public void testListCrashClientLocale ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpMacPoolsQueryExpectations ( t ) ; collection.setUriInfo ( uriInfo ) ; try { getCollection ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; } finally { locales.clear ( ) ; } }

Target:
public void testListCrashClientLocale ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; locales.add ( org.ovirt.engine.api.restapi.resource.CLIENT_LOCALE ) ; java.lang.Throwable t = new java.lang.RuntimeException ( FAILURE ) ; setUpMacPoolsQueryExpectations ( t ) ; collection.setUriInfo ( uriInfo ) ; try { getCollection ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyFault ( wae , org.ovirt.engine.api.restapi.resource.BACKEND_FAILED_CLIENT_LOCALE , t ) ; } }
Source:
public void configure ( org.ovirt.engine.ui.uicommonweb.models.vms.ISpice spice ) { if ( spice instanceof org.ovirt.engine.ui.uicommonweb.models.vms.ISpicePlugin ) { ( ( org.ovirt.engine.ui.uicommonweb.models.vms.ISpicePlugin ) ( spice ) ) . setPluginVersion ( getSpiceVersion ( ) ) ; ( ( org.ovirt.engine.ui.uicommonweb.models.vms.ISpicePlugin ) ( spice ) ) . setSpiceBaseURL ( org.ovirt.engine.ui.uicommonweb.Configurator.getSpiceBaseURL ( ) ) ; } spice.getOptions ( ) . setAdminConsole ( getSpiceAdminConsole ( ) ) ; spice.getOptions ( ) . setFullScreen ( getSpiceFullScreen ( ) ) ; spice.getOptions ( ) . setUsbFilter ( getUsbFilter ( ) ) ; updateSpiceUsbAutoShare ( spice ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { spice.getOptions ( ) . setFullScreen ( ( ( java.lang.Boolean ) ( returnValue ) ) ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getDiskImage ( ) { if ( ( diskImage ) == null ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = getDiskDao ( ) . get ( org.ovirt.engine.core.bll.ExportRepoImageCommand.getParameters ( ) . getImageGroupID ( ) ) ; if ( ( disk != null ) && ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE ) ) ) { diskImage = ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( disk ) ) ; } } return diskImage ; }

Target:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getDiskImage ( ) { if ( ( diskImage ) == null ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = org.ovirt.engine.core.bll.ExportRepoImageCommand.getDiskDao ( ) . get ( org.ovirt.engine.core.bll.ExportRepoImageCommand.getParameters ( ) . getImageGroupID ( ) ) ; if ( ( disk != null ) && ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE ) ) ) { diskImage = ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( disk ) ) ; } } return diskImage ; }
Source:
public void failWhenPowerManagementDisabled ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; java.util.List < java.lang.String > messages = new java.util.LinkedList < > ( ) ; boolean result = validator.isPowerManagementEnabledAndLegal ( vds , null , messages ) ; org.junit.Assert.assertFalse ( result ) ; org.junit.Assert.assertEquals ( messages.size ( ) , 1 ) ; org.junit.Assert.assertEquals ( messages.get ( 0 ) , "VDS_FENCE_DISABLED" ) ; }

Target:
public void failWhenPowerManagementDisabled ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; java.util.List < java.lang.String > messages = new java.util.LinkedList < > ( ) ; boolean result = validator.isPowerManagementEnabledAndLegal ( vds , null , messages ) ; org.junit.Assert.assertFalse ( result ) ; org.junit.Assert.assertEquals ( 1 , messages.size ( ) ) ; org.junit.Assert.assertEquals ( "VDS_FENCE_DISABLED" , messages.get ( 0 ) ) ; }
Source:
public void canDoActionSucceeds ( ) throws java.lang.Exception { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.RemoveVdsCommand < org.ovirt.engine.core.common.action.RemoveVdsParameters > ( new org.ovirt.engine.core.common.action.RemoveVdsParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , false ) ) ) ; prepareMocks ( ) ; mockVdsWithStatus ( VDSStatus.Maintenance ) ; mockVdsDynamic ( ) ; mockVmsPinnedToHost ( java.util.Collections.< java.lang.String > emptyList ( ) ) ; mockIsGlusterEnabled ( false ) ; mockHasVolumeOnServer ( false ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( command ) ; }

Target:
public void canDoActionSucceeds ( ) throws java.lang.Exception { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.RemoveVdsCommand ( new org.ovirt.engine.core.common.action.RemoveVdsParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , false ) ) ) ; prepareMocks ( ) ; mockVdsWithStatus ( VDSStatus.Maintenance ) ; mockVdsDynamic ( ) ; mockVmsPinnedToHost ( java.util.Collections.< java.lang.String > emptyList ( ) ) ; mockIsGlusterEnabled ( false ) ; mockHasVolumeOnServer ( false ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( command ) ; }
Source:
protected void EntityChanging ( java.lang.Object newValue , java.lang.Object oldValue ) { org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup = ( ( org.ovirt.engine.core.common.businessentities.VDSGroup ) ( newValue ) ) ; getNewNetworkCommand ( ) . setIsExecutionAllowed ( ( ( vdsGroup != null ) && ( ( vdsGroup.getstorage_pool_id ( ) ) != null ) ) ) ; }

Target:
protected void EntityChanging ( java.lang.Object newValue , java.lang.Object oldValue ) { org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup = ( ( org.ovirt.engine.core.common.businessentities.VDSGroup ) ( newValue ) ) ; getNewNetworkCommand ( ) . setIsExecutionAllowed ( ( ( vdsGroup != null ) && ( ( vdsGroup.getStoragePoolId ( ) ) != null ) ) ) ; }
Source:
public static byte [ ] ToByteArray ( java.util.UUID uuid ) { java.lang.String guidStr = uuid.toString ( ) ; java.lang.String [ ] guidParts = guidStr.split ( "-" ) ; if ( ( guidParts == null ) || ( ( guidParts.length ) == 0 ) ) { return null ; } java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream ( ) ; for ( java.lang.String guidPart : guidParts ) { org.ovirt.engine.core.utils.GuidUtils.writeGUIDPartToStream ( guidPart , baos ) ; } return baos.toByteArray ( ) ; }

Target:
public static byte [ ] toByteArray ( java.util.UUID uuid ) { java.lang.String guidStr = uuid.toString ( ) ; java.lang.String [ ] guidParts = guidStr.split ( "-" ) ; if ( ( guidParts == null ) || ( ( guidParts.length ) == 0 ) ) { return null ; } java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream ( ) ; for ( java.lang.String guidPart : guidParts ) { org.ovirt.engine.core.utils.GuidUtils.writeGUIDPartToStream ( guidPart , baos ) ; } return baos.toByteArray ( ) ; }
Source:
static void verifyModelSpecific ( org.ovirt.engine.api.model.Disk model , int index ) { assertEquals ( GUIDS [ index ] . toString ( ) , model.getId ( ) ) ; assertFalse ( model.isSetVm ( ) ) ; assertTrue ( model.isSparse ( ) ) ; assertTrue ( ( ! ( model.isBootable ( ) ) ) ) ; assertTrue ( model.isPropagateErrors ( ) ) ; }

Target:
static void verifyModelSpecific ( org.ovirt.engine.api.model.Disk model , int index ) { assertEquals ( GUIDS [ index ] . toString ( ) , model.getId ( ) ) ; assertFalse ( model.isSetVm ( ) ) ; assertTrue ( model.isSparse ( ) ) ; assertTrue ( model.isPropagateErrors ( ) ) ; }
Source:
protected void updateVirtioScsiAvailability ( ) { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = getModel ( ) . getSelectedCluster ( ) ; boolean isVirtioScsiEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigValuePreConverted ( ConfigurationValues.VirtIoScsiEnabled , cluster.getcompatibility_version ( ) . getValue ( ) ) ) ) ; getModel ( ) . getIsVirtioScsiEnabled ( ) . setIsAvailable ( isVirtioScsiEnabled ) ; }

Target:
protected void updateVirtioScsiAvailability ( ) { org.ovirt.engine.core.common.businessentities.VDSGroup cluster = getModel ( ) . getSelectedCluster ( ) ; boolean isVirtioScsiEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.VirtIoScsiEnabled , cluster.getcompatibility_version ( ) . getValue ( ) ) ) ) ; getModel ( ) . getIsVirtioScsiEnabled ( ) . setIsAvailable ( isVirtioScsiEnabled ) ; }
Source:
protected org.ovirt.engine.api.model.Host postPopulate ( org.ovirt.engine.api.model.Host from ) { while ( ( from.getPort ( ) ) == 0 ) { from.setPort ( org.ovirt.engine.api.restapi.types.MappingTestHelper.rand ( 65535 ) ) ; } from.setProtocol ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.HostProtocol.class ) ) ; from.getSpm ( ) . setPriority ( 3 ) ; from.getPowerManagement ( ) . setPmProxies ( new org.ovirt.engine.api.model.PmProxies ( ) ) ; return from ; }

Target:
protected org.ovirt.engine.api.model.Host postPopulate ( org.ovirt.engine.api.model.Host from ) { while ( ( from.getPort ( ) ) == 0 ) { from.setPort ( org.ovirt.engine.api.restapi.types.MappingTestHelper.rand ( 65535 ) ) ; } from.getSpm ( ) . setPriority ( 3 ) ; from.getPowerManagement ( ) . setPmProxies ( new org.ovirt.engine.api.model.PmProxies ( ) ) ; return from ; }
Source:
public void setup ( ) { map = new org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap ( ) ; cmd.init ( ) ; org.mockito.Mockito.doReturn ( storagePoolDao ) . when ( cmd ) . getStoragePoolDao ( ) ; org.mockito.Mockito.doReturn ( storageDomainDao ) . when ( cmd ) . getStorageDomainDao ( ) ; org.mockito.Mockito.doReturn ( eventQueue ) . when ( cmd ) . getEventQueue ( ) ; }

Target:
public void setup ( ) { map = new org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap ( ) ; cmd.init ( ) ; org.mockito.Mockito.doReturn ( storagePoolDao ) . when ( cmd ) . getStoragePoolDao ( ) ; org.mockito.Mockito.doReturn ( storageDomainDao ) . when ( cmd ) . getStorageDomainDao ( ) ; }
Source:
private void addBond ( ) { org.ovirt.engine.core.common.action.AddIscsiBondParameters params = new org.ovirt.engine.core.common.action.AddIscsiBondParameters ( createIscsiBond ( ) ) ; startProgress ( null ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runAction ( VdcActionType.AddIscsiBond , params , new org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { org.ovirt.engine.ui.uicommonweb.models.datacenters.IscsiBondModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.datacenters.IscsiBondModel ) ( result.getState ( ) ) ) ; model.stopProgress ( ) ; model.cancel ( ) ; } } , this ) ; }

Target:
private void addBond ( ) { org.ovirt.engine.core.common.action.AddIscsiBondParameters params = new org.ovirt.engine.core.common.action.AddIscsiBondParameters ( createIscsiBond ( ) ) ; startProgress ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runAction ( VdcActionType.AddIscsiBond , params , new org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { org.ovirt.engine.ui.uicommonweb.models.datacenters.IscsiBondModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.datacenters.IscsiBondModel ) ( result.getState ( ) ) ) ; model.stopProgress ( ) ; model.cancel ( ) ; } } , this ) ; }
Source:
public java.util.List < org.ovirt.engine.core.bll.utils.PermissionSubject > getPermissionCheckSubjects ( ) { org.ovirt.engine.core.compat.Guid networkId = ( ( org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) ) == null ) ? null : org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) . getId ( ) ; return java.util.Collections.singletonList ( new org.ovirt.engine.core.bll.utils.PermissionSubject ( networkId , org.ovirt.engine.core.common.VdcObjectType.Network , org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getActionType ( ) . getActionGroup ( ) ) ) ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.Network getNetwork ( ) { return org.ovirt.engine.core.bll.network.cluster.DetachNetworkToVdsGroupCommand.getParameters ( ) . getNetwork ( ) ; }
Source:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.VDS_SHUTDOWN_VDS_NOT_FOUND ) ; returnValue = false ; } if ( ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) . getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Down ) ) || ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) . getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.NonResponsive ) ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_SHUTDOWN_NO_RESPONSE ) ; returnValue = false ; } return returnValue ; }

Target:
protected boolean canDoAction ( ) { boolean returnValue = true ; if ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) ) == null ) { addCanDoActionMessage ( VdcBllMessages.VDS_SHUTDOWN_VDS_NOT_FOUND ) ; returnValue = false ; } if ( ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.Down ) ) || ( ( org.ovirt.engine.core.bll.ShutdownVdsCommand.getVds ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VDSStatus.NonResponsive ) ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_SHUTDOWN_NO_RESPONSE ) ; returnValue = false ; } return returnValue ; }
Source:
public void testQueryWithNonExistingHostId ( ) { org.mockito.Mockito.when ( getQueryParameters ( ) . getVdsId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; getQuery ( ) . setInternalExecution ( true ) ; getQuery ( ) . executeCommand ( ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( getQuery ( ) , true ) ; org.ovirt.engine.core.bll.hostdeploy.GetoVirtISOsTest.checkReturnValueEmpty ( getQuery ( ) ) ; }

Target:
public void testQueryWithNonExistingHostId ( ) { org.mockito.Mockito.when ( getQueryParameters ( ) . getId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; getQuery ( ) . setInternalExecution ( true ) ; getQuery ( ) . executeCommand ( ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkSucceeded ( getQuery ( ) , true ) ; org.ovirt.engine.core.bll.hostdeploy.GetoVirtISOsTest.checkReturnValueEmpty ( getQuery ( ) ) ; }
Source:
private static java.util.List < org.ovirt.engine.core.compat.Guid > extractIconIds ( java.util.Collection < org.ovirt.engine.core.common.businessentities.VM > vms , boolean smallIcons , boolean largeIcons ) { final java.util.List < org.ovirt.engine.core.compat.Guid > result = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vms ) { if ( smallIcons ) { result.add ( vm.getStaticData ( ) . getSmallIconId ( ) ) ; } if ( largeIcons ) { result.add ( vm.getStaticData ( ) . getLargeIconId ( ) ) ; } } return result ; }

Target:
private static java.util.List < org.ovirt.engine.core.compat.Guid > extractIconIds ( java.util.Collection < org.ovirt.engine.core.common.businessentities.VM > vms , boolean smallIcons , boolean largeIcons ) { final java.util.List < org.ovirt.engine.core.compat.Guid > result = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vms ) { if ( vm == null ) { continue ; } if ( smallIcons ) { result.add ( vm.getStaticData ( ) . getSmallIconId ( ) ) ; } if ( largeIcons ) { result.add ( vm.getStaticData ( ) . getLargeIconId ( ) ) ; } } return result ; }
Source:
private boolean checkLunsInStorageDomain ( java.util.List < java.lang.String > lunIds , org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.LUNs > lunsFromDb = org.ovirt.engine.core.bll.storage.RefreshLunsSizeCommand.getLunDao ( ) . getAllForVolumeGroup ( org.ovirt.engine.core.bll.storage.RefreshLunsSizeCommand.getStorageDomain ( ) . getStorage ( ) ) ; java.util.Set < java.lang.String > lunsSet = new java.util.HashSet < > ( lunIds ) ; for ( org.ovirt.engine.core.common.businessentities.storage.LUNs lun : lunsFromDb ) { if ( lunsSet.contains ( lun.getLUN_id ( ) ) ) { lunsSet.remove ( lun.getLUN_id ( ) ) ; } } return lunsSet.isEmpty ( ) ; }

Target:
private boolean checkLunsInStorageDomain ( java.util.List < java.lang.String > lunIds ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.LUNs > lunsFromDb = org.ovirt.engine.core.bll.storage.RefreshLunsSizeCommand.getLunDao ( ) . getAllForVolumeGroup ( org.ovirt.engine.core.bll.storage.RefreshLunsSizeCommand.getStorageDomain ( ) . getStorage ( ) ) ; java.util.Set < java.lang.String > lunsSet = new java.util.HashSet < > ( lunIds ) ; for ( org.ovirt.engine.core.common.businessentities.storage.LUNs lun : lunsFromDb ) { if ( lunsSet.contains ( lun.getLUN_id ( ) ) ) { lunsSet.remove ( lun.getLUN_id ( ) ) ; } } return lunsSet.isEmpty ( ) ; }
Source:
public boolean equals ( java.lang.Object obj ) { if ( ( this ) == obj ) { return true ; } if ( obj == null ) { return false ; } if ( ! ( obj instanceof org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap ) ) { return false ; } org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap other = ( ( org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap ) ( obj ) ) ; return ( ( java.util.Objects.equals ( id , other.id ) ) && ( java.util.Objects.equals ( quotaId , other.quotaId ) ) ) && ( java.util.Objects.equals ( diskProfileId , other.diskProfileId ) ) ; }

Target:
public boolean equals ( java.lang.Object obj ) { if ( ( this ) == obj ) { return true ; } if ( ! ( obj instanceof org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap ) ) { return false ; } org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap other = ( ( org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap ) ( obj ) ) ; return ( ( java.util.Objects.equals ( id , other.id ) ) && ( java.util.Objects.equals ( quotaId , other.quotaId ) ) ) && ( java.util.Objects.equals ( diskProfileId , other.diskProfileId ) ) ; }
Source:
public void validateSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" , null ) ) ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void validateSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" ) ) ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
public org.ovirt.engine.ui.uicommonweb.validation.ValidationResult Validate ( java.lang.String value ) { org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ipValidation = org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.IP_VALIDATOR.Validate ( value ) ; if ( ! ( ipValidation.getSuccess ( ) ) ) { return ipValidation ; } org.ovirt.engine.ui.uicommonweb.validation.ValidationResult result = new org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ( ) ; if ( value != null ) { result.setSuccess ( validateNetMask ( value ) ) ; result.setReasons ( org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.reasons ) ; } return result ; }

Target:
public org.ovirt.engine.ui.uicommonweb.validation.ValidationResult validate ( java.lang.Object value ) { org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ipValidation = org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.IP_VALIDATOR.validate ( value ) ; if ( ! ( ipValidation.getSuccess ( ) ) ) { return ipValidation ; } org.ovirt.engine.ui.uicommonweb.validation.ValidationResult result = new org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ( ) ; if ( ( value != null ) && ( value instanceof java.lang.String ) ) { result.setSuccess ( validateNetMask ( ( ( java.lang.String ) ( value ) ) ) ) ; result.setReasons ( org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.reasons ) ; } return result ; }