auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static org.ovirt.engine.core.common.businessentities.QuotaVdsGroup getSpecificQuotaVdsGroup ( org.ovirt.engine.core.compat.Guid quotaId ) { org.ovirt.engine.core.common.businessentities.QuotaVdsGroup quotaVdsGroup = new org.ovirt.engine.core.common.businessentities.QuotaVdsGroup ( ) ; quotaVdsGroup.setQuotaVdsGroupId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; quotaVdsGroup.setQuotaId ( quotaId ) ; quotaVdsGroup.setVdsGroupId ( FixturesTool.VDS_GROUP_RHEL6_NFS ) ; quotaVdsGroup.setVirtualCpu ( 2880 ) ; quotaVdsGroup.setMemSizeMB ( 16000000L ) ; quotaVdsGroup.setVirtualCpuUsage ( 0 ) ; quotaVdsGroup.setMemSizeMBUsage ( 0L ) ; return quotaVdsGroup ; }

Target:
private static org.ovirt.engine.core.common.businessentities.QuotaVdsGroup getSpecificQuotaVdsGroup ( org.ovirt.engine.core.compat.Guid quotaId ) { org.ovirt.engine.core.common.businessentities.QuotaVdsGroup quotaVdsGroup = new org.ovirt.engine.core.common.businessentities.QuotaVdsGroup ( ) ; quotaVdsGroup.setQuotaVdsGroupId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; quotaVdsGroup.setQuotaId ( quotaId ) ; quotaVdsGroup.setVdsGroupId ( FixturesTool.VDS_GROUP_RHEL6_NFS ) ; quotaVdsGroup.setVirtualCpu ( 2880 ) ; quotaVdsGroup.setMemSizeMB ( 16000000L ) ; quotaVdsGroup.setVirtualCpuUsage ( 0 ) ; quotaVdsGroup.setMemSizeMBUsage ( 0L ) ; return quotaVdsGroup ; }
Source:
public void setEnabled ( boolean enabled ) { decorated.setEnabled ( enabled ) ; if ( enabled ) { label.replaceClassName ( style.labelDisabled ( ) , style.labelEnabled ( ) ) ; } else { label.replaceClassName ( style.labelEnabled ( ) , style.labelDisabled ( ) ) ; } }

Target:
public void setEnabled ( boolean enabled ) { decorated.setEnabled ( enabled ) ; if ( enabled ) { label.getElement ( ) . replaceClassName ( style.labelDisabled ( ) , style.labelEnabled ( ) ) ; } else { label.getElement ( ) . replaceClassName ( style.labelEnabled ( ) , style.labelDisabled ( ) ) ; } }
Source:
public boolean isNextRow ( ) { if ( ! ( openSocket ) ) { return false ; } java.io.InputStream in ; try { askForStatus ( ) ; in = s.getInputStream ( ) ; java.io.LineNumberReader reader = new java.io.LineNumberReader ( new java.io.InputStreamReader ( in ) ) ; return "NEXT_ROW" . equals ( reader.readLine ( ) ) ; } catch ( java.io.IOException e ) { e.printStackTrace ( ) ; return false ; } }

Target:
public synchronized boolean isNextBreakpoint ( ) { if ( ! ( openSocket ) ) { return false ; } try { askForStatus ( ) ; ois = new routines.system.NoHeaderObjectInputStream ( s.getInputStream ( ) ) ; routines.system.TraceBean traceBean = ( ( routines.system.TraceBean ) ( ois.readObject ( ) ) ) ; return traceBean.equals ( TraceStatusBean.NEXT_BREAKPOINT ) ; } catch ( java.io.IOException e ) { e.printStackTrace ( ) ; return false ; } catch ( java.lang.ClassNotFoundException e ) { e.printStackTrace ( ) ; return false ; } }
Source:
public void testCDAStoragePoolHasTasks ( ) { java.util.List < org.ovirt.engine.core.compat.Guid > tasks = java.util.Arrays.asList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.doReturn ( tasks ) . when ( asyncTaskDAOMock ) . getAsyncTaskIdsByStoragePoolId ( storagePoolId ) ; org.junit.Assert.assertFalse ( "canDoAction did not fail on a Storage Pool with running tasks" , command.canDoAction ( ) ) ; org.ovirt.engine.core.bll.CommandAssertUtils.checkMessagesContains ( command , VdcBllMessages.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS ) ; }

Target:
public void testCDAStoragePoolHasTasks ( ) { java.util.List < org.ovirt.engine.core.compat.Guid > tasks = java.util.Arrays.asList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.doReturn ( tasks ) . when ( asyncTaskDAOMock ) . getAsyncTaskIdsByStoragePoolId ( storagePoolId ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( "canDoAction did not fail on a Storage Pool with running tasks" , command , VdcBllMessages.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS ) ; }
Source:
protected static void SetImageStatus ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage , org.ovirt.engine.core.common.businessentities.ImageStatus imageStatus ) { if ( diskImage != null ) { diskImage.setimageStatus ( imageStatus ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getImageDao ( ) . update ( diskImage.getImage ( ) ) ; } }

Target:
protected void setImageStatus ( org.ovirt.engine.core.common.businessentities.ImageStatus imageStatus ) { org.ovirt.engine.core.common.businessentities.DiskImage diskImage = ( org.ovirt.engine.core.bll.BaseImagesCommand.getParameters ( ) . isImportEntity ( ) ) ? getDestinationDiskImage ( ) : getDiskImage ( ) ; diskImage.setimageStatus ( imageStatus ) ; getImageDao ( ) . update ( diskImage.getImage ( ) ) ; }
Source:
public void reuseSession ( ) { java.lang.String sessionId = getSessionId ( ) ; if ( sessionId != null ) { org.ovirt.engine.ui.webadmin.plugin.restapi.RestApiSessionAcquiredEvent.fire ( eventBus , sessionId ) ; scheduleKeepAliveHeartbeat ( ) ; } else { org.ovirt.engine.ui.webadmin.plugin.restapi.RestApiSessionManager.logger.severe ( "Engine REST API session ID is not available" ) ; } }

Target:
public void reuseSession ( ) { if ( ( getSessionId ( ) ) != null ) { processSessionId ( getSessionId ( ) ) ; } else { getSessionId ( new org.ovirt.engine.ui.frontend.communication.StorageCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.String result ) { if ( result != null ) { restApiSessionId = result ; processSessionId ( result ) ; } else { processSessionIdException ( ) ; } } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { processSessionIdException ( ) ; } private void processSessionIdException ( ) { org.ovirt.engine.ui.webadmin.plugin.restapi.RestApiSessionManager.logger.severe ( "Engine REST API session ID is not available" ) ; } } ) ; } }
Source:
public org.ovirt.engine.core.common.businessentities.gluster.GlusterServer mapRow ( java.sql.ResultSet rs , int rowNum ) throws java.sql.SQLException { org.ovirt.engine.core.common.businessentities.gluster.GlusterServer glusterServer = new org.ovirt.engine.core.common.businessentities.gluster.GlusterServer ( ) ; glusterServer.setId ( org.ovirt.engine.core.compat.Guid.createGuidFromStringDefaultEmpty ( rs.getString ( "server_id" ) ) ) ; glusterServer.setGlusterServerUuid ( org.ovirt.engine.core.compat.Guid.createGuidFromStringDefaultEmpty ( rs.getString ( "gluster_server_uuid" ) ) ) ; return glusterServer ; }

Target:
public org.ovirt.engine.core.common.businessentities.gluster.GlusterServer mapRow ( java.sql.ResultSet rs , int rowNum ) throws java.sql.SQLException { org.ovirt.engine.core.common.businessentities.gluster.GlusterServer glusterServer = new org.ovirt.engine.core.common.businessentities.gluster.GlusterServer ( ) ; glusterServer.setId ( getGuidDefaultEmpty ( rs , "server_id" ) ) ; glusterServer.setGlusterServerUuid ( getGuidDefaultEmpty ( rs , "gluster_server_uuid" ) ) ; return glusterServer ; }
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.bll.validator.NetworkValidator validator = new org.ovirt.engine.core.bll.validator.NetworkValidator ( org.ovirt.engine.core.bll.network.dc.RemoveNetworkCommand.getNetworkDAO ( ) . get ( getNetwork ( ) . getId ( ) ) ) ; return ( ( ( validate ( validator.networkIsSet ( ) ) ) && ( validate ( validator.notManagementNetwork ( ) ) ) ) && ( validate ( validator.networkNotUsedByVms ( ) ) ) ) && ( validate ( validator.networkNotUsedByTemplates ( ) ) ) ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.bll.validator.NetworkValidator validator = new org.ovirt.engine.core.bll.validator.NetworkValidator ( org.ovirt.engine.core.bll.network.dc.RemoveNetworkCommand.getNetworkDAO ( ) . get ( getNetwork ( ) . getId ( ) ) ) ; return ( ( ( ( validate ( validator.networkIsSet ( ) ) ) && ( validate ( validator.notManagementNetwork ( ) ) ) ) && ( validate ( validator.notIscsiBondNetwork ( ) ) ) ) && ( validate ( validator.networkNotUsedByVms ( ) ) ) ) && ( validate ( validator.networkNotUsedByTemplates ( ) ) ) ; }
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.bll.GetNetworksByStoragePoolIdQuery.getQueryReturnValue ( ) . setReturnValue ( org.ovirt.engine.core.bll.GetNetworksByStoragePoolIdQuery.getDbFacade ( ) . getNetworkDao ( ) . getAllForDataCenter ( org.ovirt.engine.core.bll.GetNetworksByStoragePoolIdQuery.getParameters ( ) . getId ( ) , org.ovirt.engine.core.bll.GetNetworksByStoragePoolIdQuery.getUserID ( ) , org.ovirt.engine.core.bll.GetNetworksByStoragePoolIdQuery.getParameters ( ) . isFiltered ( ) ) ) ; }

Target:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.bll.GetNetworksByDataCenterIdQuery.getQueryReturnValue ( ) . setReturnValue ( org.ovirt.engine.core.bll.GetNetworksByDataCenterIdQuery.getDbFacade ( ) . getNetworkDao ( ) . getAllForDataCenter ( org.ovirt.engine.core.bll.GetNetworksByDataCenterIdQuery.getParameters ( ) . getId ( ) , org.ovirt.engine.core.bll.GetNetworksByDataCenterIdQuery.getUserID ( ) , org.ovirt.engine.core.bll.GetNetworksByDataCenterIdQuery.getParameters ( ) . isFiltered ( ) ) ) ; }
Source:
protected void UpdateDetailsAvailability ( ) { if ( ( getSelectedItem ( ) ) != null ) { org.ovirt.engine.core.common.businessentities.Disk disk = ( ( org.ovirt.engine.core.common.businessentities.Disk ) ( getSelectedItem ( ) ) ) ; diskVmListModel.setIsAvailable ( ( ( disk.getVmEntityType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.TEMPLATE ) ) ) ; diskTemplateListModel.setIsAvailable ( ( ( disk.getVmEntityType ( ) ) == ( org.ovirt.engine.core.common.businessentities.VmEntityType.TEMPLATE ) ) ) ; diskStorageListModel.setIsAvailable ( ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) ) ) ; } }

Target:
protected void updateDetailsAvailability ( ) { if ( ( getSelectedItem ( ) ) != null ) { org.ovirt.engine.core.common.businessentities.Disk disk = ( ( org.ovirt.engine.core.common.businessentities.Disk ) ( getSelectedItem ( ) ) ) ; diskVmListModel.setIsAvailable ( ( ( disk.getVmEntityType ( ) ) != ( org.ovirt.engine.core.common.businessentities.VmEntityType.TEMPLATE ) ) ) ; diskTemplateListModel.setIsAvailable ( ( ( disk.getVmEntityType ( ) ) == ( org.ovirt.engine.core.common.businessentities.VmEntityType.TEMPLATE ) ) ) ; diskStorageListModel.setIsAvailable ( ( ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) ) ) ; } }
Source:
public void save ( org.ovirt.engine.core.common.businessentities.async_tasks task , org.ovirt.engine.core.common.VdcObjectType entityType , org.ovirt.engine.core.compat.Guid ... entityIds ) { org.ovirt.engine.core.dao.AsyncTaskDAODbFacadeImpl.AsyncTaskParameterSource parameterSource = getTaskParameterSource ( task ) ; parameterSource.addValue ( "entity_type" , ( entityType != null ? entityType.toString ( ) : null ) ) ; parameterSource.addValue ( "entity_ids" , org.apache.commons.lang.StringUtils.join ( entityIds , "," ) ) ; getCallsHandler ( ) . executeModification ( "Insertasync_tasks" , parameterSource ) ; }

Target:
public void save ( org.ovirt.engine.core.common.businessentities.async_tasks task , org.ovirt.engine.core.common.VdcObjectType entityType , org.ovirt.engine.core.compat.Guid ... entityIds ) { org.ovirt.engine.core.dao.AsyncTaskDAODbFacadeImpl.AsyncTaskParameterSource parameterSource = getTaskParameterSource ( task ) ; parameterSource.addValue ( "entity_type" , ( entityType != null ? entityType.toString ( ) : null ) ) ; parameterSource.addValue ( "started_at" , task.getStartTime ( ) ) ; parameterSource.addValue ( "entity_ids" , org.apache.commons.lang.StringUtils.join ( entityIds , "," ) ) ; getCallsHandler ( ) . executeModification ( "Insertasync_tasks" , parameterSource ) ; }
Source:
public void canDoActionVmInPreview ( ) { createParameters ( ) ; initDiskImage ( diskImageId ) ; initVm ( VMStatus.Up , null , diskImageId ) ; setVmInPreview ( true ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ) . when ( snapshotsValidator ) . vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ; }

Target:
public void canDoActionVmInPreview ( ) { createParameters ( ) ; initDiskImage ( diskImageGroupId , diskImageId ) ; initVm ( VMStatus.Up , null , diskImageId ) ; setVmInPreview ( true ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ) . when ( snapshotsValidator ) . vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( command , VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.VM createEmptyVm ( ) { org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm.setCustomProperties ( StringUtils.EMPTY ) ; vm.setPredefinedProperties ( StringUtils.EMPTY ) ; vm.setUserDefinedProperties ( StringUtils.EMPTY ) ; return vm ; }

Target:
private org.ovirt.engine.core.common.businessentities.VM createEmptyVm ( ) { org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm.setCustomProperties ( StringUtils.EMPTY ) ; vm.setPredefinedProperties ( StringUtils.EMPTY ) ; vm.setUserDefinedProperties ( StringUtils.EMPTY ) ; vm.setClusterCompatibilityVersion ( org.ovirt.engine.core.compat.Version.getLast ( ) ) ; vm.setClusterArch ( ArchitectureType.x86_64 ) ; return vm ; }
Source:
protected void initLoginModel ( ) { final T loginModel = getLoginModel ( ) ; loginModel.getLoggedInEvent ( ) . addListener ( new org.ovirt.engine.core.compat.IEventListener ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.core.compat.Event ev , java.lang.Object sender , org.ovirt.engine.core.compat.EventArgs args ) { onLogin ( loginModel ) ; } } ) ; }

Target:
protected void initLoginModel ( ) { final T loginModel = getLoginModel ( ) ; loginModel.getLoggedInEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { onLogin ( loginModel ) ; } } ) ; }
Source:
public org.ovirt.engine.core.dal.dbbroker.DbFacade getDbFacade ( ) { return dbFacade ; }

Target:
public void setup ( ) { initVds ( ) ; initConditions ( ) ; org.mockito.Mockito.when ( vdsManager.getRefreshStatistics ( ) ) . thenReturn ( false ) ; updater = org.mockito.Mockito.spy ( new org.ovirt.engine.core.vdsbroker.HostMonitoring ( vdsManager , vds , org.mockito.Mockito.mock ( org.ovirt.engine.core.vdsbroker.MonitoringStrategy.class ) , resourceManager , dbFacade ) { @ java.lang.Override protected void auditLog ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase auditLogable , org.ovirt.engine.core.common.AuditLogType logType ) { org.ovirt.engine.core.common.businessentities.AuditLog al = new org.ovirt.engine.core.common.businessentities.AuditLog ( ) ; al.setLogType ( logType ) ; mockAuditLogDao.save ( al ) ; } } ) ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { super . eventRaised ( ev , sender , args ) ; if ( ( ev.equals ( EntityModel.EntityChangedEventDefinition ) ) && ( sender == ( getPath ( ) ) ) ) { getPathChangedEvent ( ) . raise ( this , EventArgs.Empty ) ; } else if ( ( ev.equals ( EntityModel.EntityChangedEventDefinition ) ) && ( sender == ( getOverride ( ) ) ) ) { Override_EntityChanged ( args ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { super . eventRaised ( ev , sender , args ) ; if ( ( ev.matchesDefinition ( EntityModel.EntityChangedEventDefinition ) ) && ( sender == ( getPath ( ) ) ) ) { getPathChangedEvent ( ) . raise ( this , EventArgs.Empty ) ; } else if ( ( ev.matchesDefinition ( EntityModel.EntityChangedEventDefinition ) ) && ( sender == ( getOverride ( ) ) ) ) { Override_EntityChanged ( args ) ; } }
Source:
protected void refreshModel ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( getEntity ( ) ) ) ; super . syncSearch ( VdcQueryType.GetAllAuditLogsByVMName , new org.ovirt.engine.core.common.queries.GetAllAuditLogsByVMNameParameters ( vm.getName ( ) ) ) ; }

Target:
protected void refreshModel ( ) { if ( ( getEntity ( ) ) == null ) { return ; } org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( getEntity ( ) ) ) ; super . syncSearch ( VdcQueryType.GetAllAuditLogsByVMName , new org.ovirt.engine.core.common.queries.NameQueryParameters ( vm.getName ( ) ) ) ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { getTenantName ( ) . setIsAvailable ( isTypeTenantAware ( ) ) ; boolean providerNeutron = isTypeOpenStackNetwork ( ) ; getApiVersion ( ) . setIsAvailable ( providerNeutron ) ; if ( providerNeutron ) { org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; java.lang.String pluginName = ( properties == null ) ? new java.lang.String ( ) : properties.getPluginType ( ) ; getPluginType ( ) . setSelectedItem ( org.ovirt.engine.ui.uicommonweb.models.providers.NeutronPluginTranslator.getDisplayStringForPluginName ( pluginName ) ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { boolean isTenant = isTypeTenantAware ( ) ; getTenantName ( ) . setIsAvailable ( isTenant ) ; if ( isTenant ) { org.ovirt.engine.core.common.businessentities.TenantProviderProperties properties = ( ( org.ovirt.engine.core.common.businessentities.TenantProviderProperties ) ( provider.getAdditionalProperties ( ) ) ) ; getTenantName ( ) . setEntity ( ( properties == null ? null : properties.getTenantName ( ) ) ) ; } boolean isNeutron = isTypeOpenStackNetwork ( ) ; getApiVersion ( ) . setIsAvailable ( isNeutron ) ; getNeutronAgentModel ( ) . setIsAvailable ( isNeutron ) ; }
Source:
public void executeCommand ( ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.DeactivateGlusterVolumeSnapshot , new org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters ( getUpServer ( ) . getId ( ) , getGlusterVolumeName ( ) , getParameters ( ) . getSnapshotName ( ) ) ) ; setSucceeded ( retVal.getSucceeded ( ) ) ; if ( ! ( getSucceeded ( ) ) ) { handleVdsError ( AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DEACTIVATE_FAILED , retVal.getVdsError ( ) . getMessage ( ) ) ; } else { getGlusterVolumeSnapshotDao ( ) . updateSnapshotStatus ( getSnapshot ( ) . getId ( ) , GlusterSnapshotStatus.DEACTIVATED ) ; } }

Target:
public void executeCommand ( ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue retVal = runVdsCommand ( VDSCommandType.DeactivateGlusterVolumeSnapshot , new org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters ( getUpServer ( ) . getId ( ) , getGlusterVolumeName ( ) , getParameters ( ) . getSnapshotName ( ) ) ) ; setSucceeded ( retVal.getSucceeded ( ) ) ; if ( ! ( getSucceeded ( ) ) ) { handleVdsError ( AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DEACTIVATE_FAILED , retVal.getVdsError ( ) . getMessage ( ) ) ; } else { glusterVolumeSnapshotDao.updateSnapshotStatus ( getSnapshot ( ) . getId ( ) , GlusterSnapshotStatus.DEACTIVATED ) ; } }
Source:
public boolean isTemplate ( ) { java.lang.String id1 = "1" ; java.lang.String id2 = "2" ; org.ovirt.engine.core.utils.ovf.xml.XmlNode node = _document.SelectSingleNode ( "//*/Content/TemplateId" ) ; if ( ! ( org.apache.commons.lang.StringUtils.isBlank ( node.innerText ) ) ) { id1 = node.innerText ; } org.ovirt.engine.core.utils.ovf.xml.XmlNodeList list = _document.SelectNodes ( "//*/Content/Section" ) ; for ( org.ovirt.engine.core.utils.ovf.xml.XmlNode section : list ) { java.lang.String value = section.attributes.get ( "xsi:type" ) . getValue ( ) ; if ( org.apache.commons.lang.StringUtils.equals ( value , "ovf:OperatingSystemSection_Type" ) ) { id2 = section.attributes.get ( "ovf:id" ) . getValue ( ) ; } } return org.apache.commons.lang.StringUtils.equals ( id1 , id2 ) ; }

Target:
public boolean isTemplate ( ) { java.lang.String id1 = "1" ; java.lang.String id2 = "2" ; org.ovirt.engine.core.utils.ovf.xml.XmlNode node = _document.selectSingleNode ( "//*/Content/TemplateId" ) ; if ( ! ( org.apache.commons.lang.StringUtils.isBlank ( node.innerText ) ) ) { id1 = node.innerText ; } org.ovirt.engine.core.utils.ovf.xml.XmlNodeList list = _document.selectNodes ( "//*/Content/Section" ) ; for ( org.ovirt.engine.core.utils.ovf.xml.XmlNode section : list ) { java.lang.String value = section.attributes.get ( "xsi:type" ) . getValue ( ) ; if ( org.apache.commons.lang.StringUtils.equals ( value , "ovf:OperatingSystemSection_Type" ) ) { id2 = section.attributes.get ( "ovf:id" ) . getValue ( ) ; } } return org.apache.commons.lang.StringUtils.equals ( id1 , id2 ) ; }
Source:
private void AddVdsStaticToDb ( ) { org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) . setserver_SSL_enabled ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > GetValue ( ConfigValues.UseSecureConnectionWithServers ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsStaticDAO ( ) . save ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) ) ; org.ovirt.engine.core.bll.AddVdsCommand.getCompensationContext ( ) . snapshotNewEntity ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) ) ; setVdsIdRef ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) . getId ( ) ) ; org.ovirt.engine.core.bll.AddVdsCommand.setVds ( null ) ; }

Target:
private void AddVdsStaticToDb ( ) { org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) . setserver_SSL_enabled ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > GetValue ( ConfigValues.UseSecureConnectionWithServers ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsStaticDao ( ) . save ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) ) ; org.ovirt.engine.core.bll.AddVdsCommand.getCompensationContext ( ) . snapshotNewEntity ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) ) ; setVdsIdRef ( org.ovirt.engine.core.bll.AddVdsCommand.getParameters ( ) . getVdsStaticData ( ) . getId ( ) ) ; org.ovirt.engine.core.bll.AddVdsCommand.setVds ( null ) ; }
Source:
private void mockConfig ( ) { mcr.mockConfigValue ( ConfigValues.PredefinedVMProperties , Version.v3_0 , "" ) ; mcr.mockConfigValue ( ConfigValues.UserDefinedVMProperties , Version.v3_0 , "" ) ; mcr.mockConfigValue ( ConfigValues.InitStorageSparseSizeInGB , 1 ) ; mcr.mockConfigValue ( ConfigValues.VirtIoScsiEnabled , Version.v3_3 , true ) ; mcr.mockConfigValue ( ConfigValues.ValidNumOfMonitors , java.util.Arrays.asList ( "1,2,4" . split ( "," ) ) ) ; mcr.mockConfigValue ( ConfigValues.IsMigrationSupported , Version.v3_3 , org.ovirt.engine.core.bll.AddVmCommandTest.migrationMap ) ; mcr.mockConfigValue ( ConfigValues.MaxIoThreadsPerVm , 127 ) ; }

Target:
private void mockConfig ( ) { mcr.mockConfigValue ( ConfigValues.InitStorageSparseSizeInGB , 1 ) ; mcr.mockConfigValue ( ConfigValues.ValidNumOfMonitors , java.util.Arrays.asList ( "1,2,4" . split ( "," ) ) ) ; mcr.mockConfigValue ( ConfigValues.IsMigrationSupported , Version.v4_0 , org.ovirt.engine.core.bll.AddVmCommandTest.migrationMap ) ; mcr.mockConfigValue ( ConfigValues.MaxIoThreadsPerVm , 127 ) ; }
Source:
private void runActionExecutionFailed ( final org.ovirt.engine.core.common.action.VdcActionType actionType , final org.ovirt.engine.core.common.errors.VdcFault fault ) { if ( ( getEventsHandler ( ) ) != null ) { java.lang.String translatedMessage = translateVdcFault ( fault ) ; fault.setMessage ( translatedMessage ) ; getEventsHandler ( ) . runActionExecutionFailed ( actionType , fault ) ; } }

Target:
public void storeInHttpSession ( final java.lang.String key , final java.lang.String value ) { getOperationManager ( ) . storeInHttpSession ( key , value ) ; }
Source:
public void syncNetworkOnVlan ( ) { org.ovirt.engine.core.common.businessentities.network.Network net = createNetwork ( "net" ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net ) ; nic.setVlanId ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextInt ( ) ) ; mockExistingNetworks ( net ) ; mockExistingIfaces ( nic ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForSync ( nic ) ) ; validateAndAssertNetworkModified ( helper , net ) ; }

Target:
public void syncNetworkOnVlan ( ) { org.ovirt.engine.core.common.businessentities.network.Network net = createNetwork ( "net" ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface baseNic = createNic ( "baseNic" , null ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net ) ; nic.setBaseInterface ( baseNic.getName ( ) ) ; nic.setVlanId ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextInt ( ) ) ; mockExistingNetworks ( net ) ; mockExistingIfaces ( nic , baseNic ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForSync ( nic ) ) ; validateAndAssertNetworkModified ( helper , net ) ; }
Source:
public void testEnoughSpaceToMergeSnapshotsWithMultipleDisk ( ) { spySdValidatorForOneDomain ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.DiskImage > imagesDisks = org.ovirt.engine.core.bll.RemoveSnapshotCommandTest.mockMultipleSourceImagesForDomain ( 4 , org.ovirt.engine.core.bll.RemoveSnapshotCommandTest.STORAGE_DOMAIN_ID , org.ovirt.engine.core.bll.RemoveSnapshotCommandTest.IMAGE_ACTUAL_SIZE_GB ) ; org.mockito.Mockito.doReturn ( imagesDisks ) . when ( cmd ) . getSourceImages ( ) ; mockStorageDomainDAOGetForStoragePool ( 22 , org.ovirt.engine.core.bll.RemoveSnapshotCommandTest.STORAGE_DOMAIN_ID ) ; org.junit.Assert.assertTrue ( "Validation should succeed. Free space minus threshold should be bigger then summarize all disks size" , cmd.validateStorageDomains ( ) ) ; }

Target:
public void testCanDoActionEnoughSpace ( ) { prepareForVmValidatorTests ( ) ; spySdValidator ( ) ; cmd.getVm ( ) . setStatus ( VMStatus.Up ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( vmValidator ) . vmHostCanLiveMerge ( ) ; mockDisksList ( 4 ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( cmd ) ; }
Source:
public static org.ovirt.engine.api.model.Application map ( java.lang.String appName , org.ovirt.engine.api.model.Application template ) { org.ovirt.engine.api.model.Application model = ( template != null ) ? template : new org.ovirt.engine.api.model.Application ( ) ; model.setName ( appName ) ; model.setId ( new org.ovirt.engine.core.compat.Guid ( appName.getBytes ( ) , true ) . toString ( ) ) ; return model ; }

Target:
public static org.ovirt.engine.api.model.Application map ( java.lang.String appName , org.ovirt.engine.api.model.Application template ) { org.ovirt.engine.api.model.Application model = ( template != null ) ? template : new org.ovirt.engine.api.model.Application ( ) ; model.setName ( appName ) ; model.setId ( org.ovirt.engine.api.restapi.utils.GuidUtils.asGuid ( appName.getBytes ( ) , true ) . toString ( ) ) ; return model ; }
Source:
public void setup ( ) { initVds ( ) ; initConditions ( ) ; org.mockito.Mockito.when ( vdsManager.getRefreshStatistics ( ) ) . thenReturn ( false ) ; updater = new org.ovirt.engine.core.vdsbroker.HostMonitoring ( vdsManager , vds , org.mockito.Mockito.mock ( org.ovirt.engine.core.vdsbroker.MonitoringStrategy.class ) , resourceManager , dbFacade , auditLogDirector ) ; }

Target:
public void setup ( ) { initVds ( ) ; initConditions ( ) ; org.mockito.Mockito.when ( vdsManager.isTimeToRefreshStatistics ( ) ) . thenReturn ( false ) ; updater = new org.ovirt.engine.core.vdsbroker.HostMonitoring ( vdsManager , vds , org.mockito.Mockito.mock ( org.ovirt.engine.core.vdsbroker.MonitoringStrategy.class ) , resourceManager , dbFacade , auditLogDirector ) ; }
Source:
public static void countAllTemplates ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmTemplateCount , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }

Target:
public void getHostPublicKey ( 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.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetServerSSHPublicKey , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
private void notIscsiBondNetworkTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.IscsiBond > iscsiBonds ) { org.ovirt.engine.core.dao.IscsiBondDao iscsiBondDao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.IscsiBondDao.class ) ; org.mockito.Mockito.when ( iscsiBondDao.getIscsiBondsByNetworkId ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( iscsiBonds ) ; org.mockito.Mockito.when ( dbFacade.getIscsiBondDao ( ) ) . thenReturn ( iscsiBondDao ) ; org.junit.Assert.assertThat ( validator.notIscsiBondNetwork ( ) , matcher ) ; }

Target:
private void notIscsiBondNetworkTest ( org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.util.List < org.ovirt.engine.core.common.businessentities.IscsiBond > iscsiBonds ) { org.ovirt.engine.core.dao.IscsiBondDao iscsiBondDao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.IscsiBondDao.class ) ; org.mockito.Mockito.when ( iscsiBondDao.getIscsiBondsByNetworkId ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( iscsiBonds ) ; org.mockito.Mockito.when ( dbFacade.getIscsiBondDao ( ) ) . thenReturn ( iscsiBondDao ) ; org.junit.Assert.assertThat ( validator.notIscsiBondNetwork ( ) , matcher ) ; }
Source:
public void notHostedEngineVM ( ) { vm.setOrigin ( OriginType.OVIRT ) ; org.assertj.core.api.Assertions.assertThatThrownBy ( ( ) -> new org.ovirt.engine.core.utils.ovf.HostedEngineOvfWriter ( vm , images , luns , version , emulatedMachine , cpuId , osRepository ) ) . isInstanceOf ( java.lang.IllegalArgumentException.class ) . hasMessageContaining ( "Hosted Engine" ) ; }

Target:
public void notHostedEngineVM ( ) { vm.setOrigin ( OriginType.OVIRT ) ; org.assertj.core.api.Assertions.assertThatThrownBy ( ( ) -> new org.ovirt.engine.core.utils.ovf.HostedEngineOvfWriter ( vm , fullEntityOvfData , version , emulatedMachine , cpuId , osRepository ) ) . isInstanceOf ( java.lang.IllegalArgumentException.class ) . hasMessageContaining ( "Hosted Engine" ) ; }
Source:
protected void storeRdpData ( org.ovirt.engine.ui.uicommonweb.models.HasConsoleModel model , org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.KeyMaker keyMaker ) { org.ovirt.engine.ui.uicommonweb.models.vms.RdpConsoleModel consoleModel = asRdpConsoleModel ( model ) ; org.ovirt.engine.ui.uicommonweb.models.vms.IRdp rdpImpl = consoleModel.getrdp ( ) ; clientStorage.setLocalItem ( keyMaker.make ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.RDP_CLIENT_MODE ) , consoleModel.getClientConsoleMode ( ) . toString ( ) ) ; storeBool ( keyMaker.make ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.USE_LOCAL_DRIVES ) , rdpImpl.getUseLocalDrives ( ) ) ; }

Target:
protected void storeRdpData ( org.ovirt.engine.ui.uicommonweb.models.VmConsoles vmConsoles , org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.KeyMaker keyMaker ) { org.ovirt.engine.ui.uicommonweb.models.vms.RdpConsoleModel consoleModel = vmConsoles.getConsoleModel ( org.ovirt.engine.ui.uicommonweb.models.vms.RdpConsoleModel.class ) ; org.ovirt.engine.ui.uicommonweb.models.vms.IRdp rdpImpl = consoleModel.getrdp ( ) ; clientStorage.setLocalItem ( keyMaker.make ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.RDP_CLIENT_MODE ) , consoleModel.getClientConsoleMode ( ) . toString ( ) ) ; storeBool ( keyMaker.make ( org.ovirt.engine.ui.common.utils.ConsoleOptionsFrontendPersisterImpl.USE_LOCAL_DRIVES ) , rdpImpl.getUseLocalDrives ( ) ) ; }
Source:
public void validateSucceeds ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" ) ) ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void validateSucceeds ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" ) ) , getStorageDevice ( "sdb" ) , org.ovirt.engine.core.common.businessentities.CacheModeType.writethrough , 10 ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
private void adjustDisksImageConfiguration ( java.util.Collection < org.ovirt.engine.core.common.businessentities.DiskImage > diskImages ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : diskImages ) { if ( ( ( diskImage.getVolumeType ( ) . equals ( VolumeType.Sparse ) ) && ( diskImage.getVolumeFormat ( ) . equals ( VolumeFormat.RAW ) ) ) && ( getDestintationDomainTypeFromDisk ( diskImage ) . isBlockDomain ( ) ) ) { diskImage.setvolumeFormat ( VolumeFormat.COW ) ; } } }

Target:
private void adjustDisksImageConfiguration ( java.util.Collection < org.ovirt.engine.core.common.businessentities.storage.DiskImage > diskImages ) { for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskImages ) { if ( ( ( diskImage.getVolumeType ( ) . equals ( VolumeType.Sparse ) ) && ( diskImage.getVolumeFormat ( ) . equals ( VolumeFormat.RAW ) ) ) && ( getDestintationDomainTypeFromDisk ( diskImage ) . isBlockDomain ( ) ) ) { diskImage.setvolumeFormat ( VolumeFormat.COW ) ; } } }
Source:
protected boolean validateImagesAndVMStates ( ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) . getStoragePoolId ( ) , Guid.Empty , hasImages ( ) , hasImages ( ) , hasImages ( ) , hasImages ( ) , true , true , null ) ; }

Target:
protected boolean validateImagesAndVMStates ( ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVmId ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) . getStoragePoolId ( ) , Guid.Empty , hasImages ( ) , hasImages ( ) , hasImages ( ) , hasImages ( ) , true , true , null ) ; }
Source:
public void testAllDomainsHaveSpaceForNewDisksFailure ( ) { setUpGeneralValidations ( ) ; setUpDiskValidations ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > disksList = java.util.Collections.emptyList ( ) ; org.mockito.Mockito.doReturn ( disksList ) . when ( cmd ) . getDisksList ( ) ; org.mockito.Mockito.doReturn ( disksList ) . when ( cmd ) . getDisksListForChecks ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ) . when ( multipleStorageDomainsValidator ) . allDomainsHaveSpaceForNewDisks ( disksList ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ; org.mockito.Mockito.verify ( multipleStorageDomainsValidator ) . allDomainsHaveSpaceForNewDisks ( disksList ) ; }

Target:
public void testAllDomainsHaveSpaceForNewDisksFailure ( ) { setUpGeneralValidations ( ) ; setUpDiskValidations ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskImage > disksList = java.util.Collections.emptyList ( ) ; org.mockito.Mockito.doReturn ( disksList ) . when ( cmd ) . getSnappableVmDisks ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ) . when ( multipleStorageDomainsValidator ) . allDomainsHaveSpaceForNewDisks ( disksList ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionFailure ( cmd , EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN ) ; org.mockito.Mockito.verify ( multipleStorageDomainsValidator ) . allDomainsHaveSpaceForNewDisks ( disksList ) ; }
Source:
public void testFindDefaultManagementNetworkMultipleNonDefault ( ) { org.mockito.Mockito.when ( mockNetworkDao.getAllForDataCenter ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ) . thenReturn ( java.util.Arrays.asList ( mockNetwork , mockNetwork ) ) ; org.mockito.Mockito.when ( mockNetworkDao.getManagementNetworks ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ) . thenReturn ( java.util.Arrays.asList ( mockNetwork , mockDefaultEngineNetwork ) ) ; final org.ovirt.engine.core.common.businessentities.network.Network actual = underTest.findDefaultManagementNetwork ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ; org.junit.Assert.assertNull ( actual ) ; }

Target:
public void testFindDefaultManagementNetworkMultipleNonDefault ( ) { org.mockito.Mockito.when ( mockNetworkDao.getAllForDataCenter ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ) . thenReturn ( java.util.Arrays.asList ( mockNetwork , mockNetwork ) ) ; org.mockito.Mockito.when ( mockNetworkDao.getManagementNetworks ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ) . thenReturn ( java.util.Arrays.asList ( mockNetwork , mockDefaultEngineNetwork ) ) ; final org.ovirt.engine.core.common.businessentities.network.Network actual = underTest.findDefaultManagementNetwork ( org.ovirt.engine.core.bll.network.cluster.DefaultManagementNetworkFinderImplTest.TEST_DC_ID ) ; org.junit.jupiter.api.Assertions.assertNull ( actual ) ; }
Source:
private void assertCorrectSlaveCountInLabeledValidBonds ( int numberOfSlaves , java.lang.String reason , org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > valid ) { java.lang.String bondName = "bondName" ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName ( bondName , true ) ; java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > slaves = createGivenCountOfSlavesForBond ( bondName , numberOfSlaves ) ; org.junit.Assert.assertThat ( reason , new org.ovirt.engine.core.bll.validator.HostInterfaceValidator ( vdsNetworkInterface ) . labeledValidBond ( slaves ) , valid ) ; }

Target:
private void assertCorrectSlaveCountInLabeledValidBonds ( int numberOfSlaves , java.lang.String reason , org.hamcrest.Matcher < org.ovirt.engine.core.bll.ValidationResult > matcher , java.lang.String bondName ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName ( bondName , true ) ; java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > slaves = createGivenCountOfSlavesForBond ( bondName , numberOfSlaves ) ; org.junit.Assert.assertThat ( reason , new org.ovirt.engine.core.bll.validator.HostInterfaceValidator ( vdsNetworkInterface ) . labeledValidBond ( slaves ) , matcher ) ; }
Source:
public void testCheckGroupsCanBeAttachedAdminIssues ( ) { getRole ( ) . setType ( RoleType.USER ) ; org.ovirt.engine.core.common.businessentities.RoleGroupMap map = new org.ovirt.engine.core.common.businessentities.RoleGroupMap ( org.ovirt.engine.core.common.businessentities.ActionGroup.DELETE_STORAGE_POOL , getParams ( ) . getRoleId ( ) ) ; mockGetAllForRole ( java.util.Collections.singletonList ( map ) ) ; java.util.List < java.lang.String > messages = new java.util.ArrayList < > ( 1 ) ; org.junit.Assert.assertTrue ( "canDoAction should fail" , getCommand ( ) . checkIfGroupsCanBeAttached ( messages ) ) ; org.junit.Assert.assertEquals ( "wrong messages" , EngineMessage.CANNOT_ADD_ACTION_GROUPS_TO_ROLE_TYPE.toString ( ) , messages.get ( 0 ) ) ; }

Target:
public void testCheckGroupsCanBeAttachedAdminIssues ( ) { getRole ( ) . setType ( RoleType.USER ) ; org.ovirt.engine.core.common.businessentities.RoleGroupMap map = new org.ovirt.engine.core.common.businessentities.RoleGroupMap ( org.ovirt.engine.core.common.businessentities.ActionGroup.DELETE_STORAGE_POOL , getParams ( ) . getRoleId ( ) ) ; mockGetAllForRole ( java.util.Collections.singletonList ( map ) ) ; java.util.List < java.lang.String > messages = new java.util.ArrayList < > ( 1 ) ; org.junit.Assert.assertTrue ( "validate should fail" , getCommand ( ) . checkIfGroupsCanBeAttached ( messages ) ) ; org.junit.Assert.assertEquals ( "wrong messages" , EngineMessage.CANNOT_ADD_ACTION_GROUPS_TO_ROLE_TYPE.toString ( ) , messages.get ( 0 ) ) ; }
Source:
protected void updateInputTitle ( java.util.ArrayList < java.lang.String > grayOutReasons , com.google.gwt.dom.client.Element input ) { java.lang.String title = org.ovirt.engine.ui.common.widget.uicommon.storage.AbstractSanStorageList.constants.empty ( ) ; for ( java.lang.String reason : grayOutReasons ) { title += reason + ( org.ovirt.engine.ui.common.widget.uicommon.storage.AbstractSanStorageList.constants.space ( ) ) ; } input.setTitle ( title ) ; }

Target:
protected void updateInputTitle ( java.util.ArrayList < java.lang.String > grayOutReasons , com.google.gwt.dom.client.Element input ) { java.lang.StringBuilder title = new java.lang.StringBuilder ( org.ovirt.engine.ui.common.widget.uicommon.storage.AbstractSanStorageList.constants.empty ( ) ) ; for ( java.lang.String reason : grayOutReasons ) { title.append ( reason ) . append ( org.ovirt.engine.ui.common.widget.uicommon.storage.AbstractSanStorageList.constants.space ( ) ) ; } input.setTitle ( title.toString ( ) ) ; }
Source:
protected boolean canDoAction ( ) { if ( org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.isImagesAlreadyOnTarget ( ) ) { if ( ! ( validateUnregisteredEntity ( vmFromConfiguration , ovfEntityData ) ) ) { return false ; } setImagesWithStoragePoolId ( org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getStorageDomain ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getVm ( ) . getImages ( ) ) ; } return super . canDoAction ( ) ; }

Target:
protected boolean canDoAction ( ) { if ( org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.isImagesAlreadyOnTarget ( ) ) { org.ovirt.engine.core.bll.validator.ImportValidator importValidator = org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getImportValidator ( ) ; if ( ! ( validate ( importValidator.validateUnregisteredEntity ( vmFromConfiguration , ovfEntityData , org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getImages ( ) ) ) ) ) { return false ; } setImagesWithStoragePoolId ( org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getStorageDomain ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.bll.ImportVmFromConfigurationCommand.getVm ( ) . getImages ( ) ) ; } return super . canDoAction ( ) ; }
Source:
public static org.ovirt.engine.api.model.Storage map ( org.ovirt.engine.api.restapi.types.StorageDomain entity , org.ovirt.engine.api.model.Storage template ) { org.ovirt.engine.api.model.Storage model = ( template != null ) ? template : new org.ovirt.engine.api.model.Storage ( ) ; model.setId ( entity.getstorage ( ) ) ; model.setType ( org.ovirt.engine.api.restapi.types.StorageDomainMapper.map ( entity.getstorage_type ( ) , null ) ) ; model.setVolumeGroup ( new org.ovirt.engine.api.model.VolumeGroup ( ) ) ; model.getVolumeGroup ( ) . setId ( entity.getstorage ( ) ) ; return model ; }

Target:
public static org.ovirt.engine.api.model.Storage map ( org.ovirt.engine.api.restapi.types.StorageDomain entity , org.ovirt.engine.api.model.Storage template ) { org.ovirt.engine.api.model.Storage model = ( template != null ) ? template : new org.ovirt.engine.api.model.Storage ( ) ; model.setId ( entity.getStorage ( ) ) ; model.setType ( org.ovirt.engine.api.restapi.types.StorageDomainMapper.map ( entity.getStorageType ( ) , null ) ) ; model.setVolumeGroup ( new org.ovirt.engine.api.model.VolumeGroup ( ) ) ; model.getVolumeGroup ( ) . setId ( entity.getStorage ( ) ) ; return model ; }
Source:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( getReturnStatus ( ) ) ; switch ( returnStatus ) { case StorageServerConnectionRefIdAlreadyInUse : case StorageServerConnectionRefIdDoesNotExist : org.ovirt.engine.core.vdsbroker.vdsbroker.VDSExceptionBase outEx = new org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException ( java.lang.String.format ( "Failed in vdscommand %1$s, error = %2$s" , org.ovirt.engine.core.vdsbroker.vdsbroker.ConnectStorageServerVDSCommand.getCommandName ( ) , getReturnStatus ( ) . mMessage ) ) ; InitializeVdsError ( returnStatus ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.ConnectStorageServerVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; throw outEx ; default : super . ProceedProxyReturnValue ( ) ; break ; } }

Target:
protected void ProceedProxyReturnValue ( ) { org.ovirt.engine.core.common.errors.VdcBllErrors returnStatus = GetReturnValueFromStatus ( getReturnStatus ( ) ) ; switch ( returnStatus ) { case StorageServerConnectionRefIdAlreadyInUse : case StorageServerConnectionRefIdDoesNotExist : org.ovirt.engine.core.vdsbroker.vdsbroker.VDSExceptionBase outEx = new org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException ( java.lang.String.format ( "Failed in vdscommand %1$s, error = %2$s" , org.ovirt.engine.core.vdsbroker.vdsbroker.ConnectStorageServerVDSCommand.getCommandName ( ) , getReturnStatus ( ) . mMessage ) ) ; initializeVdsError ( returnStatus ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.ConnectStorageServerVDSCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; throw outEx ; default : super . ProceedProxyReturnValue ( ) ; break ; } }