auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testMissingParameters ( ) { org.ovirt.engine.api.model.Vm vm = new org.ovirt.engine.api.model.Vm ( ) ; vm.setDescription ( "incomplete" ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( vm , "name" , "host" , "status" ) ; org.junit.Assert.fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Vm" , "name" , "host" , "status" ) ; } }

Target:
public void testMissingParameters ( ) { org.ovirt.engine.api.model.Vm vm = new org.ovirt.engine.api.model.Vm ( ) ; vm.setDescription ( "incomplete" ) ; try { org.ovirt.engine.api.common.util.CompletenessAssertor.validateParameters ( vm , "name" , "host" , "status" ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException on incomplete model" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Vm" , "name" , "host" , "status" ) ; } }
Source:
protected void initDetailModels ( ) { super . initDetailModels ( ) ; org.ovirt.engine.ui.uicompat.ObservableCollection < org.ovirt.engine.ui.uicommonweb.models.EntityModel > list = new org.ovirt.engine.ui.uicompat.ObservableCollection < org.ovirt.engine.ui.uicommonweb.models.EntityModel > ( ) ; list.add ( new org.ovirt.engine.ui.uicommonweb.models.providers.ProviderGeneralModel ( ) ) ; providerNetworkListModel = new org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel ( ) ; list.add ( providerNetworkListModel ) ; setDetailModels ( list ) ; }

Target:
private void setModelList ( final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderGeneralModel providerGeneralModel , final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel providerNetworkListModel ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.HasEntity < org.ovirt.engine.core.common.businessentities.Provider > > list = new java.util.ArrayList < > ( ) ; list.add ( providerGeneralModel ) ; list.add ( providerNetworkListModel ) ; setDetailModels ( list ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlanDevice ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic , org.ovirt.engine.core.common.businessentities.network.Network network ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface vlan = new org.ovirt.engine.core.common.businessentities.network.Vlan ( ) ; vlan.setNetworkName ( network.getName ( ) ) ; vlan.setVdsId ( nic.getVdsId ( ) ) ; vlan.setName ( org.ovirt.engine.core.utils.NetworkUtils.getVlanDeviceName ( nic , network ) ) ; vlan.setBootProtocol ( NetworkBootProtocol.NONE ) ; return vlan ; }

Target:
protected org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface createVlanDevice ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic , org.ovirt.engine.core.common.businessentities.network.Network network ) { org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface vlan = new org.ovirt.engine.core.common.businessentities.network.Vlan ( ) ; vlan.setNetworkName ( network.getName ( ) ) ; vlan.setVdsId ( nic.getVdsId ( ) ) ; vlan.setName ( org.ovirt.engine.core.utils.NetworkUtils.constructVlanDeviceName ( nic , network ) ) ; vlan.setVlanId ( network.getVlanId ( ) ) ; vlan.setBaseInterface ( nic.getName ( ) ) ; vlan.setBootProtocol ( NetworkBootProtocol.NONE ) ; return vlan ; }
Source:
public static void getGlusterSwiftServices ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid serverId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? source : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetGlusterServerServicesByServerId , new org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters ( serverId , org.ovirt.engine.core.common.businessentities.gluster.ServiceType.GLUSTER_SWIFT ) , aQuery ) ; }

Target:
public static void getGlusterVolumeOptionInfoList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId ) { org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetGlusterVolumeOptionsInfo , new org.ovirt.engine.core.common.queries.gluster.GlusterParameters ( clusterId ) , aQuery ) ; }
Source:
public void testNoStringSubstitutionWithList ( ) { org.ovirt.engine.core.common.interfaces.ErrorTranslator et = new org.ovirt.engine.core.utils.ErrorTranslatorImpl ( org.ovirt.engine.core.utils.ErrorTranslatorTest.FILENAME ) ; java.util.List < java.lang.String > error = et.TranslateErrorText ( java.util.Arrays.asList ( org.ovirt.engine.core.utils.ErrorTranslatorTest.TEST_KEY_NO_REPLACEMENT ) ) ; org.junit.Assert.assertTrue ( "Size" , ( ( error.size ( ) ) == 1 ) ) ; org.junit.Assert.assertEquals ( "String should equal" , "VM not found" , error.get ( 0 ) ) ; }

Target:
public void testNoStringSubstitutionWithList ( ) { org.ovirt.engine.core.common.interfaces.ErrorTranslator et = new org.ovirt.engine.core.utils.ErrorTranslatorImpl ( org.ovirt.engine.core.utils.ErrorTranslatorTest.FILENAME ) ; java.util.List < java.lang.String > error = et.translateErrorText ( java.util.Arrays.asList ( org.ovirt.engine.core.utils.ErrorTranslatorTest.TEST_KEY_NO_REPLACEMENT ) ) ; org.junit.Assert.assertTrue ( "Size" , ( ( error.size ( ) ) == 1 ) ) ; org.junit.Assert.assertEquals ( "String should equal" , "VM not found" , error.get ( 0 ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getStorageServerConnectionDao ( ) ) ; existingConnection = dao.get ( "0cc146e8-e5ed-482c-8814-270bc48c297f" ) ; newServerConnection = new org.ovirt.engine.core.common.businessentities.storage_server_connections ( ) ; newServerConnection.setid ( "0cc146e8-e5ed-482c-8814-270bc48c2980" ) ; newServerConnection.setconnection ( org.ovirt.engine.core.dao.StorageServerConnectionDAOTest.EXISTING_DOMAIN_STORAGE_NAME ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getStorageServerConnectionDao ( ) ) ; existingConnection = dao.get ( "0cc146e8-e5ed-482c-8814-270bc48c297f" ) ; existingNfsAutoConnection = dao.get ( FixturesTool.EXISTING_STORAGE_CONNECTION_NFS_AUTO_ID.toString ( ) ) ; newServerConnection = new org.ovirt.engine.core.common.businessentities.storage_server_connections ( ) ; newServerConnection.setid ( "0cc146e8-e5ed-482c-8814-270bc48c2980" ) ; newServerConnection.setconnection ( org.ovirt.engine.core.dao.StorageServerConnectionDAOTest.EXISTING_DOMAIN_STORAGE_NAME ) ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult isDomainWithinThresholds ( ) { org.ovirt.engine.core.common.businessentities.StorageDomainDynamic dynamic = storageDomain.getStorageDynamicData ( ) ; if ( ( ( dynamic != null ) && ( ( dynamic.getAvailableDiskSize ( ) ) != null ) ) && ( ( dynamic.getAvailableDiskSize ( ) ) < ( org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator.getLowDiskSpaceThreshold ( ) ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN , storageName ( ) ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult isDomainWithinThresholds ( ) { if ( storageDomain.getStorageType ( ) . isCinderDomain ( ) ) { return org.ovirt.engine.core.bll.ValidationResult.VALID ; } org.ovirt.engine.core.common.businessentities.StorageDomainDynamic dynamic = storageDomain.getStorageDynamicData ( ) ; if ( ( ( dynamic != null ) && ( ( dynamic.getAvailableDiskSize ( ) ) != null ) ) && ( ( dynamic.getAvailableDiskSize ( ) ) < ( org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator.getLowDiskSpaceThreshold ( ) ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN , storageName ( ) ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private org.ovirt.engine.core.common.businessentities.AuditLog create ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable auditLogable , org.ovirt.engine.core.common.AuditLogType logType , java.lang.String loggerString ) { if ( auditLogable.isExternal ( ) ) { return auditLogable.createAuditLog ( logType , loggerString ) ; } final java.lang.String messageByType = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.getMessageOrNull ( logType ) ; if ( messageByType == null ) { return null ; } else { java.lang.String resolvedMessage = resolveMessage ( messageByType , auditLogable ) ; return auditLogable.createAuditLog ( logType , resolvedMessage ) ; } }

Target:
private org.ovirt.engine.core.common.businessentities.AuditLog create ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable auditLogable , org.ovirt.engine.core.common.AuditLogType logType , java.lang.String loggerString ) { if ( auditLogable.isExternal ( ) ) { return auditLogable.createAuditLog ( logType , loggerString ) ; } final java.lang.String messageByType = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.getMessageOrNull ( logType ) ; if ( messageByType == null ) { return null ; } else { java.lang.String resolvedMessage = org.ovirt.engine.core.dal.dbbroker.auditloghandling.MessageResolver.resolveMessage ( messageByType , auditLogable ) ; return auditLogable.createAuditLog ( logType , resolvedMessage ) ; } }
Source:
protected void setUpCommand ( ) { command = createCommand ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areTemplateImagesInStorageReady ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . verifyAddVm ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateDiskProfiles ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateCpuProfile ( ) ; }

Target:
protected void setUpCommand ( ) { org.mockito.Mockito.doNothing ( ) . when ( command ) . initTemplate ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areTemplateImagesInStorageReady ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . verifyAddVm ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateDiskProfiles ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . setAndValidateCpuProfile ( ) ; }
Source:
private void setDetailList ( final org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel vmGeneralModel , final org.ovirt.engine.ui.uicommonweb.models.templates.TemplateImportInterfaceListModel templateImportInterfaceListModel ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.HasEntity > list = new java.util.ArrayList < > ( ) ; list.add ( vmGeneralModel ) ; list.add ( templateImportInterfaceListModel ) ; list.add ( templateImportDiskListModel ) ; setDetailModels ( list ) ; }

Target:
private void setDetailList ( final org.ovirt.engine.ui.uicommonweb.models.templates.TemplateImportGeneralModel templateImportGeneralModel , final org.ovirt.engine.ui.uicommonweb.models.templates.TemplateImportInterfaceListModel templateImportInterfaceListModel ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.HasEntity > list = new java.util.ArrayList < > ( ) ; list.add ( templateImportGeneralModel ) ; list.add ( templateImportInterfaceListModel ) ; list.add ( templateImportDiskListModel ) ; setDetailModels ( list ) ; }
Source:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpGetEntityExpectations ( 1 , org.ovirt.engine.api.restapi.resource.NON_EXISTANT_GUID , null ) ; control.replay ( ) ; try { collection.remove ( org.ovirt.engine.api.restapi.resource.NON_EXISTANT_GUID.toString ( ) ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( wae.getResponse ( ) . getStatus ( ) , 404 ) ; } }

Target:
public void testRemoveFailed ( ) throws java.lang.Exception { setUpGetEntityExpectations ( VdcQueryType.Search , org.ovirt.engine.core.common.queries.SearchParameters.class , new java.lang.String [ ] { "SearchPattern" , "SearchTypeValue" } , new java.lang.Object [ ] { "users:" , org.ovirt.engine.core.common.interfaces.SearchType.DBUser } , getUsers ( ) ) ; doTestBadRemove ( true , false , org.ovirt.engine.api.restapi.resource.FAILURE ) ; }
Source:
protected boolean setAndValidateDiskProfiles ( ) { if ( ( ( diskInfoDestinationMap ) != null ) && ( ! ( diskInfoDestinationMap.isEmpty ( ) ) ) ) { java.util.Map < org.ovirt.engine.core.common.businessentities.storage.DiskImage , org.ovirt.engine.core.compat.Guid > map = new java.util.HashMap < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskInfoDestinationMap.values ( ) ) { map.put ( diskImage , diskImage.getStorageIds ( ) . get ( 0 ) ) ; } return validate ( org.ovirt.engine.core.bll.profiles.DiskProfileHelper.setAndValidateDiskProfiles ( map , org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommand.getCurrentUser ( ) ) ) ; } return true ; }

Target:
protected boolean setAndValidateDiskProfiles ( ) { if ( ( ( diskInfoDestinationMap ) != null ) && ( ! ( diskInfoDestinationMap.isEmpty ( ) ) ) ) { java.util.Map < org.ovirt.engine.core.common.businessentities.storage.DiskImage , org.ovirt.engine.core.compat.Guid > map = new java.util.HashMap < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskInfoDestinationMap.values ( ) ) { map.put ( diskImage , diskImage.getStorageIds ( ) . get ( 0 ) ) ; } return validate ( diskProfileHelper.setAndValidateDiskProfiles ( map , org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommand.getCurrentUser ( ) ) ) ; } return true ; }
Source:
public javax.ws.rs.core.Response maintenance ( org.ovirt.engine.api.model.Action action ) { validateParameters ( action , "maintenanceEnabled" ) ; org.ovirt.engine.core.common.businessentities.VM entity = getEntity ( org.ovirt.engine.core.common.businessentities.VM.class , VdcQueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( guid ) , id ) ; if ( ! ( entity.isHostedEngine ( ) ) ) { throw new javax.ws.rs.WebApplicationException ( javax.ws.rs.core.Response.status ( Response.Status.BAD_REQUEST ) . entity ( "Moving to maintenance mode is currently only available for the VM containing the hosted engine." ) . build ( ) ) ; } return doAction ( ActionType.SetHaMaintenance , new org.ovirt.engine.core.common.action.SetHaMaintenanceParameters ( entity.getRunOnVds ( ) , org.ovirt.engine.core.common.businessentities.HaMaintenanceMode.GLOBAL , action.isMaintenanceEnabled ( ) ) , action ) ; }

Target:
public javax.ws.rs.core.Response maintenance ( org.ovirt.engine.api.model.Action action ) { validateParameters ( action , "maintenanceEnabled" ) ; org.ovirt.engine.core.common.businessentities.VM entity = getEntity ( org.ovirt.engine.core.common.businessentities.VM.class , QueryType.GetVmByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( guid ) , id ) ; if ( ! ( entity.isHostedEngine ( ) ) ) { throw new javax.ws.rs.WebApplicationException ( javax.ws.rs.core.Response.status ( Response.Status.BAD_REQUEST ) . entity ( "Moving to maintenance mode is currently only available for the VM containing the hosted engine." ) . build ( ) ) ; } return doAction ( ActionType.SetHaMaintenance , new org.ovirt.engine.core.common.action.SetHaMaintenanceParameters ( entity.getRunOnVds ( ) , org.ovirt.engine.core.common.businessentities.HaMaintenanceMode.GLOBAL , action.isMaintenanceEnabled ( ) ) , action ) ; }
Source:
public static java.io.InputStream loadAsStream ( java.lang.String resourceName ) { return org.ovirt.engine.api.rsdl.RsdlIOManager.class . getResourceAsStream ( resourceName ) ; }

Target:
private static void exportResource ( java.lang.String apiVersion , java.lang.String resourceName , java.io.File outputDirectory ) throws java.io.IOException { java.lang.String resourcePath = java.lang.String.format ( "/v%s/%s" , apiVersion , resourceName ) ; java.io.InputStream inputResource = org.ovirt.engine.api.rsdl.RsdlIOManager.class . getResourceAsStream ( resourcePath ) ; java.io.File outputFile = new java.io.File ( outputDirectory , resourceName ) ; java.lang.System.out.printf ( "Copying resource \"%s\" to file \"%s\"\n" , resourcePath , outputFile.getAbsolutePath ( ) ) ; org.apache.commons.io.FileUtils.copyInputStreamToFile ( inputResource , outputFile ) ; }
Source:
protected void prepareRoleForCommand ( ) { org.ovirt.engine.core.common.businessentities.Role role = org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getRole ( ) ; role.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; role.setAllowsViewingChildren ( false ) ; for ( org.ovirt.engine.core.common.businessentities.ActionGroup group : org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getParameters ( ) . getActionGroups ( ) ) { if ( group.allowsViewingChildren ( ) ) { role.setAllowsViewingChildren ( true ) ; break ; } } }

Target:
protected void prepareRoleForCommand ( ) { org.ovirt.engine.core.common.businessentities.Role role = org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getRole ( ) ; role.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; role.setAllowsViewingChildren ( false ) ; org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getRole ( ) . setAppMode ( ApplicationMode.AllModes ) ; for ( org.ovirt.engine.core.common.businessentities.ActionGroup group : org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getParameters ( ) . getActionGroups ( ) ) { if ( group.allowsViewingChildren ( ) ) { role.setAllowsViewingChildren ( true ) ; break ; } } }
Source:
public static void removeTaskFromDbByTaskId ( org.ovirt.engine.core.compat.Guid taskId ) { try { if ( ( org.ovirt.engine.core.bll.tasks.TaskManagerUtil.callRemoveTaskFromDbByTaskId ( taskId ) ) != 0 ) { org.ovirt.engine.core.bll.tasks.AsyncTaskManager.log.infoFormat ( "Removed task {0} from DataBase" , taskId ) ; } } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.bll.tasks.AsyncTaskManager.log.error ( java.lang.String.format ( "Removing task %1$s from DataBase threw an exception." , taskId ) , e ) ; } }

Target:
public static void removeTaskFromDbByTaskId ( org.ovirt.engine.core.compat.Guid taskId ) { try { if ( ( org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil.callRemoveTaskFromDbByTaskId ( taskId ) ) != 0 ) { org.ovirt.engine.core.bll.tasks.AsyncTaskManager.log.infoFormat ( "Removed task {0} from DataBase" , taskId ) ; } } catch ( java.lang.RuntimeException e ) { org.ovirt.engine.core.bll.tasks.AsyncTaskManager.log.error ( java.lang.String.format ( "Removing task %1$s from DataBase threw an exception." , taskId ) , e ) ; } }
Source:
public java.lang.Void runInTransaction ( ) { coco.persistCommand ( map ( asyncTask , coco.getCommandEntity ( asyncTask.getCommandId ( ) ) ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAsyncTaskDao ( ) . saveOrUpdate ( asyncTask ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.common.businessentities.CommandEntity cmdEntity = coco.getCommandEntity ( asyncTask.getCommandId ( ) ) ; if ( ( asyncTask.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum.finished ) ) { cmdEntity.setCommandStatus ( CommandStatus.SUCCEEDED ) ; } coco.persistCommand ( map ( asyncTask , cmdEntity ) ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getAsyncTaskDao ( ) . saveOrUpdate ( asyncTask ) ; return null ; }
Source:
public static java.util.Map < java.lang.String , java.lang.String > createAddressForVirtioScsiDisk ( int unit ) { java.util.Map < java.lang.String , java.lang.String > addressMap = new java.util.HashMap < > ( ) ; addressMap.put ( VdsProperties.Type , "drive" ) ; addressMap.put ( VdsProperties.Bus , "0" ) ; addressMap.put ( VdsProperties.target , "0" ) ; addressMap.put ( VdsProperties.Unit , java.lang.String.valueOf ( unit ) ) ; return addressMap ; }

Target:
public static java.util.Map < java.lang.String , java.lang.String > createAddressForScsiDisk ( int controller , int unit ) { java.util.Map < java.lang.String , java.lang.String > addressMap = new java.util.HashMap < > ( ) ; addressMap.put ( VdsProperties.Type , "drive" ) ; addressMap.put ( VdsProperties.Controller , java.lang.String.valueOf ( controller ) ) ; addressMap.put ( VdsProperties.Bus , "0" ) ; addressMap.put ( VdsProperties.target , "0" ) ; addressMap.put ( VdsProperties.Unit , java.lang.String.valueOf ( unit ) ) ; return addressMap ; }
Source:
public void setUp ( ) throws java.lang.Exception { testServlet = new org.ovirt.engine.core.WelcomeServlet ( ) { private static final long serialVersionUID = 1446616158991683162L ; @ java.lang.Override public java.lang.String getCurrentSsoSessionUser ( javax.servlet.http.HttpServletRequest request , java.util.Map < java.lang.String , java.lang.Object > userInfoMap ) { return "admin@internal" ; } public boolean getChangePasswordEnabled ( java.util.Map < java.lang.String , java.lang.Object > userInfoMap ) { return true ; } @ java.lang.Override public boolean isSessionValid ( javax.servlet.http.HttpServletRequest request , java.lang.String token ) { return true ; } @ java.lang.Override public java.util.Map < java.lang.String , java.lang.Object > isSsoWebappDeployed ( ) { return java.util.Collections.emptyMap ( ) ; } } ; testServlet.setBackend ( mockBackend ) ; testServlet.init ( mockBrandingManager , "/ovirt-engine" ) ; mockBackendQuery ( VdcQueryType.GetConfigurationValue , "oVirtVersion" ) ; org.mockito.Mockito.when ( mockBrandingManager.getBrandingThemes ( ) ) . thenReturn ( new java.util.ArrayList < > ( ) ) ; org.mockito.Mockito.when ( mockBrandingManager.getWelcomeSections ( org.mockito.Matchers.any ( java.util.Locale.class ) ) ) . thenReturn ( "Welcome Section HTML" ) ; }

Target:
public java.lang.String getCredentialsChangeUrl ( javax.servlet.http.HttpServletRequest request ) throws java.net.MalformedURLException { return "http://localhost:8080/ovirt-engine/sso/credentials-change.html" ; }
Source:
public static void GetHostListByDataCenter ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid spId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source != null ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > list = org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.VDS > Cast ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.IVdcQueryable > ) ( source ) ) ) ; return list ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllVdsByStoragePool , new org.ovirt.engine.core.common.queries.GetAllVdsByStoragePoolParameters ( spId ) , aQuery ) ; }

Target:
public static void GetStorageDomainListByTemplate ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid templateId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_domains > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetStorageDomainsByVmTemplateId , new org.ovirt.engine.core.common.queries.GetStorageDomainsByVmTemplateIdQueryParameters ( templateId ) , aQuery ) ; }
Source:
public java.lang.Object getDataCenter ( ) { return getEntity ( ) ; }

Target:
public void newNetworkQoS ( ) { if ( ( getWindow ( ) ) != null ) { return ; } final org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel newNetworkQoSModel = new org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel ( this , getEntity ( ) ) ; setWindow ( newNetworkQoSModel ) ; newNetworkQoSModel.getDataCenters ( ) . setItems ( java.util.Arrays.asList ( getEntity ( ) ) ) ; newNetworkQoSModel.getDataCenters ( ) . setSelectedItem ( getEntity ( ) ) ; }
Source:
private java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.network.Network > createClusterNetworksMap ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > allClusterNetworks ) { java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.network.Network > clusterNetworksMap = new java.util.HashMap < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.Network network : allClusterNetworks ) { clusterNetworksMap.put ( network.getId ( ) , network ) ; } return clusterNetworksMap ; }

Target:
private void initNetworks ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > allClusterNetworks ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigNetwork > vfsConfigNetworks = new java.util.ArrayList < > ( ) ; java.util.Set < org.ovirt.engine.core.compat.Guid > attachedNetworks = getEntity ( ) . getNetworks ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.Network network : allClusterNetworks ) { boolean isAttached = attachedNetworks.contains ( network.getId ( ) ) ; org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigNetwork vfsConfigNetwork = new org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigNetwork ( isAttached , ( isAttached ? getAttachedViaLabel ( network ) : null ) , network ) ; vfsConfigNetworks.add ( vfsConfigNetwork ) ; } networks.setItems ( vfsConfigNetworks ) ; }
Source:
protected T getMethod ( ) { if ( ( method ) == null ) { org.ovirt.engine.core.common.businessentities.VdsStatic vdsStatic = org.ovirt.engine.core.vdsbroker.irsbroker.HttpImageTaskVDSCommand.getAndSetVdsStatic ( ) ; org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.net.URL > urlInfo = org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcUtils.getConnectionUrl ( vdsStatic.getHostName ( ) , vdsStatic.getPort ( ) , "" , org.ovirt.engine.core.common.config.Config.getValue ( ConfigValues.EncryptHostCommunication ) ) ; method = concreteCreateMethod ( urlInfo.getFirst ( ) ) ; } return method ; }

Target:
protected T getMethod ( ) { if ( ( method ) == null ) { org.ovirt.engine.core.common.businessentities.VdsStatic vdsStatic = org.ovirt.engine.core.vdsbroker.irsbroker.HttpImageTaskVDSCommand.getAndSetVdsStatic ( ) ; org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.net.URL > urlInfo = org.ovirt.engine.core.vdsbroker.HttpUtils.getConnectionUrl ( vdsStatic.getHostName ( ) , vdsStatic.getPort ( ) , "" , org.ovirt.engine.core.common.config.Config.getValue ( ConfigValues.EncryptHostCommunication ) ) ; method = concreteCreateMethod ( urlInfo.getFirst ( ) ) ; } return method ; }
Source:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assert query.equals ( "" ) ; setUpEntityQueryExpectations ( VdcQueryType.GetAllImagesList , org.ovirt.engine.core.common.queries.GetAllIsoImagesListParameters.class , new java.lang.String [ ] { "StorageDomainId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , setUpFiles ( ) , failure ) ; control.replay ( ) ; }

Target:
protected void setUpQueryExpectations ( java.lang.String query , java.lang.Object failure ) throws java.lang.Exception { assert query.equals ( "" ) ; setUpEntityQueryExpectations ( VdcQueryType.GetImagesList , org.ovirt.engine.core.common.queries.GetImagesListParameters.class , new java.lang.String [ ] { "StorageDomainId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , setUpFiles ( ) , failure ) ; control.replay ( ) ; }
Source:
public void testAlerts ( ) { org.ovirt.engine.core.searchbackend.SyntaxChecker chkr = new org.ovirt.engine.core.searchbackend.SyntaxChecker ( 100 ) ; org.ovirt.engine.core.searchbackend.ISyntaxChecker curSyntaxChecker = org.ovirt.engine.core.searchbackend.SyntaxCheckerFactory.createBackendSyntaxChecker ( "foo" ) ; org.ovirt.engine.core.searchbackend.SyntaxContainer res = curSyntaxChecker.analyzeSyntaxState ( "Events: severity=error" , true ) ; java.lang.String query = chkr.generateQueryFromSyntaxContainer ( res , true ) ; org.ovirt.engine.core.searchbackend.Assert.assertEquals ( "SELECT * FROM (SELECT audit_log.audit_log_id FROM audit_log WHERE audit_log.severity = '2' and (not deleted) ORDER BY audit_log_id DESC ) as T1 OFFSET (1 -1) LIMIT 0" , query ) ; }

Target:
public void testAlerts ( ) { org.ovirt.engine.core.searchbackend.SyntaxChecker chkr = new org.ovirt.engine.core.searchbackend.SyntaxChecker ( 100 ) ; org.ovirt.engine.core.searchbackend.ISyntaxChecker curSyntaxChecker = org.ovirt.engine.core.searchbackend.SyntaxCheckerFactory.createBackendSyntaxChecker ( "foo" ) ; org.ovirt.engine.core.searchbackend.SyntaxContainer res = curSyntaxChecker.analyzeSyntaxState ( "Events: severity=error" , true ) ; java.lang.String query = chkr.generateQueryFromSyntaxContainer ( res , true ) ; junit.framework.Assert.assertEquals ( "SELECT * FROM (SELECT audit_log.* FROM audit_log WHERE audit_log.severity = '2' and (not deleted) ORDER BY audit_log_id DESC ) as T1 OFFSET (1 -1) LIMIT 0" , query ) ; }
Source:
public void testList ( ) throws java.lang.Exception { int numOfEntitiesInList = 2 ; setUpGetEntityExpectations ( VdcQueryType.GetStorageServerConnectionExtensionsByHostId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendStorageServerConnectionExtensionsResourceTest.hostID } , getEntityList ( numOfEntitiesInList ) ) ; javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.StorageConnectionExtension > retCollection = getCollection ( ) ; assertNotNull ( retCollection ) ; assertEquals ( numOfEntitiesInList , retCollection.size ( ) ) ; }

Target:
public void testList ( ) throws java.lang.Exception { int numOfEntitiesInList = 2 ; setUpGetEntityExpectations ( QueryType.GetStorageServerConnectionExtensionsByHostId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendStorageServerConnectionExtensionsResourceTest.hostID } , getEntityList ( numOfEntitiesInList ) ) ; javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.StorageConnectionExtension > retCollection = getCollection ( ) ; assertNotNull ( retCollection ) ; assertEquals ( numOfEntitiesInList , retCollection.size ( ) ) ; }
Source:
public void testRemoveNotFound ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetAllNetworks , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.core.compat.Guid.Empty } , new java.util.ArrayList < org.ovirt.engine.api.model.Network > ( ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetNetworkById , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendNetworkResourceTest.NETWORK_ID } , getEntity ( 0 ) ) ; org.ovirt.engine.api.model.Network model = org.ovirt.engine.api.restapi.resource.BackendNetworkResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.profiles.CpuProfileListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( ( lastExecutedCommand == ( getModel ( ) . getNewCommand ( ) ) ) || ( lastExecutedCommand == ( getModel ( ) . getEditCommand ( ) ) ) ) { return profilePopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.ClusterAffinityLabelListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( ( lastExecutedCommand == ( getModel ( ) . getNewCommand ( ) ) ) || ( lastExecutedCommand == ( getModel ( ) . getEditCommand ( ) ) ) ) { return popupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }
Source:
private static void setDiskList ( org.ovirt.engine.core.common.businessentities.VmTemplate vmTemplate ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommandTestAbstract.getDiskImageList ( ) ) { vmTemplate.getDiskList ( ) . add ( diskImage ) ; } java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.DiskImage > diskImageTemplate = org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommandTestAbstract.getDiskImageTempalteList ( ) ; for ( org.ovirt.engine.core.compat.Guid key : diskImageTemplate.keySet ( ) ) { vmTemplate.getDiskMap ( ) . put ( key , diskImageTemplate.get ( key ) ) ; } }

Target:
private static void setDiskList ( org.ovirt.engine.core.common.businessentities.VmTemplate vmTemplate ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommandTestAbstract.getDiskImageList ( ) ) { vmTemplate.getDiskList ( ) . add ( diskImage ) ; } java.util.Map < org.ovirt.engine.core.compat.Guid , org.ovirt.engine.core.common.businessentities.DiskImage > diskImageTemplate = org.ovirt.engine.core.bll.CommonVmPoolWithVmsCommandTestAbstract.getDiskImageTempalteList ( ) ; for ( org.ovirt.engine.core.compat.Guid key : diskImageTemplate.keySet ( ) ) { vmTemplate.getDiskTemplateMap ( ) . put ( key , diskImageTemplate.get ( key ) ) ; } }
Source:
public void OnRemove ( ) { for ( java.lang.Object item : getSelectedItems ( ) ) { org.ovirt.engine.core.common.businessentities.Role role = ( ( org.ovirt.engine.core.common.businessentities.Role ) ( item ) ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.RemoveRole , new org.ovirt.engine.core.common.action.RolesParameterBase ( role.getId ( ) ) ) ; } Cancel ( ) ; getSearchCommand ( ) . Execute ( ) ; }

Target:
public void cloneRole ( ) { commandType = org.ovirt.engine.ui.uicommonweb.models.configure.roles_ui.RoleListModel.CommandType.Clone ; org.ovirt.engine.core.common.businessentities.Role role = ( ( org.ovirt.engine.core.common.businessentities.Role ) ( getSelectedItem ( ) ) ) ; initRoleDialog ( role ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskVmElement > getAllForVm ( org.ovirt.engine.core.compat.Guid vmId ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "vm_id" , vmId ) ; return getCallsHandler ( ) . executeReadList ( "GetDiskVmElementsForVm" , org.ovirt.engine.core.dao.DiskVmElementDaoImpl.DiskVmElementRowMapper.INSTANCE , parameterSource ) ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.storage.DiskVmElement > getAllForVm ( org.ovirt.engine.core.compat.Guid vmId , org.ovirt.engine.core.compat.Guid userID , boolean isFiltered ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "vm_id" , vmId ) . addValue ( "user_id" , userID ) . addValue ( "is_filtered" , isFiltered ) ; return getCallsHandler ( ) . executeReadList ( "GetDiskVmElementsForVm" , org.ovirt.engine.core.dao.DiskVmElementDaoImpl.DiskVmElementRowMapper.INSTANCE , parameterSource ) ; }
Source:
public static void getVmNicList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid id ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ) ( source ) ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmInterfacesByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( id ) , aQuery ) ; }

Target:
public static void getDefaultSpmPriority ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.lang.Integer ) ( source ) ) . intValue ( ) : 0 ; } } ; aQuery.asyncCallback.onSuccess ( aQuery.getModel ( ) , 5 ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc refreshStoragePool ( java.lang.String spUUID , java.lang.String msdUUID , int masterVersion ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "StoragePool.refresh" ) . withParameter ( "storagepoolID" , spUUID ) . withParameter ( "masterSdUUID" , msdUUID ) . withParameter ( "masterVersion" , masterVersion ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( response ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc refreshVolume ( java.lang.String sdUUID , java.lang.String spUUID , java.lang.String imgUUID , java.lang.String volUUID ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "Volume.refresh" ) . withParameter ( "storagepoolID" , spUUID ) . withParameter ( "storagedomainID" , sdUUID ) . withParameter ( "imageID" , imgUUID ) . withParameter ( "volumeID" , volUUID ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( response ) ; }
Source:
public static void getStorageConnectionById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String id , boolean isRefresh ) { 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 ? ( ( org.ovirt.engine.core.common.businessentities.StorageServerConnections ) ( source ) ) : null ; } } ; org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase params = new org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase ( id ) ; params.setRefresh ( isRefresh ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStorageServerConnectionById , params , aQuery ) ; }

Target:
public static void isVmNameUnique ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String name ) { 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.Boolean ) ( source ) ) . booleanValue ( ) ) : false ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.IsVmWithSameNameExist , new org.ovirt.engine.core.common.queries.NameQueryParameters ( name ) , aQuery ) ; }
Source:
public java.lang.Object runInTransaction ( ) { getCompensationContext ( ) . snapshotEntityStatus ( getVm ( ) . getDynamicData ( ) , getVm ( ) . getStatus ( ) ) ; getVm ( ) . setStatus ( VMStatus.SavingState ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.UpdateVmDynamicData , new org.ovirt.engine.core.common.vdscommands.UpdateVmDynamicDataVDSCommandParameters ( getVdsId ( ) , getVm ( ) . getDynamicData ( ) ) ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; }

Target:
public java.lang.Object runInTransaction ( ) { getCompensationContext ( ) . snapshotEntityStatus ( getVm ( ) . getDynamicData ( ) , getVm ( ) . getStatus ( ) ) ; getVm ( ) . setStatus ( VMStatus.PreparingForHibernate ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . getResourceManager ( ) . RunVdsCommand ( VDSCommandType.UpdateVmDynamicData , new org.ovirt.engine.core.common.vdscommands.UpdateVmDynamicDataVDSCommandParameters ( getVdsId ( ) , getVm ( ) . getDynamicData ( ) ) ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; }
Source:
public static java.lang.String combine ( java.lang.String head , java.lang.String tail ) { if ( head.endsWith ( "/" ) ) { head = head.substring ( 0 , ( ( head.length ( ) ) - 1 ) ) ; } if ( tail.startsWith ( "/" ) ) { tail = tail.substring ( 1 ) ; } return ( head + "/" ) + tail ; }

Target:
public static java.lang.String combine ( java.lang.String head , java.lang.String tail ) { return ( ( org.apache.commons.lang.StringUtils.removeEnd ( head , "/" ) ) + "/" ) + ( org.apache.commons.lang.StringUtils.removeStart ( tail , "/" ) ) ; }
Source:
protected void executeCommand ( ) { if ( ( ( org.ovirt.engine.core.bll.RemoveVdsCommand.getVdsIdRef ( ) ) != null ) && ( CanBeRemoved ( org.ovirt.engine.core.bll.RemoveVdsCommand.getVdsId ( ) ) ) ) { glusterHostRemove ( ) ; RemoveVdsStatisticsFromDb ( ) ; RemoveVdsDynamicFromDb ( ) ; RemoveVdsStaticFromDb ( ) ; RemoveVdsFromCollection ( ) ; org.ovirt.engine.core.bll.RemoveVdsCommand.setSucceeded ( true ) ; } }

Target:
protected void executeCommand ( ) { if ( ( ( org.ovirt.engine.core.bll.RemoveVdsCommand.getVdsIdRef ( ) ) != null ) && ( CanBeRemoved ( org.ovirt.engine.core.bll.RemoveVdsCommand.getVdsId ( ) ) ) ) { glusterHostRemove ( ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void runInTransaction ( ) { RemoveVdsStatisticsFromDb ( ) ; RemoveVdsDynamicFromDb ( ) ; RemoveVdsStaticFromDb ( ) ; return null ; } } ) ; RemoveVdsFromCollection ( ) ; org.ovirt.engine.core.bll.RemoveVdsCommand.setSucceeded ( true ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.VM mockVMFromDAO ( org.ovirt.engine.core.compat.Guid requestedUser ) { org.ovirt.engine.core.common.businessentities.VM expectedVM = new org.ovirt.engine.core.common.businessentities.VM ( ) ; org.ovirt.engine.core.dao.VmDAO vmDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmDAO.class ) ; org.mockito.Mockito.when ( vmDaoMock.getAllForUserWithGroupsAndUserRoles ( requestedUser ) ) . thenReturn ( java.util.Collections.singletonList ( expectedVM ) ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmDAO ( ) ) . thenReturn ( vmDaoMock ) ; return expectedVM ; }

Target:
private org.ovirt.engine.core.common.businessentities.VM mockVMFromDAO ( org.ovirt.engine.core.compat.Guid requestedUser ) { org.ovirt.engine.core.common.businessentities.VM expectedVM = new org.ovirt.engine.core.common.businessentities.VM ( ) ; org.ovirt.engine.core.dao.VmDAO vmDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.VmDAO.class ) ; org.mockito.Mockito.when ( vmDaoMock.getAllForUserWithGroupsAndUserRoles ( requestedUser ) ) . thenReturn ( java.util.Collections.singletonList ( expectedVM ) ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmDao ( ) ) . thenReturn ( vmDaoMock ) ; return expectedVM ; }
Source:
private void onStop ( ) { final org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel ) ( getWindow ( ) ) ) ; onPowerAction ( VdcActionType.StopVm , new org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel.PowerActionParametersFactory < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) { @ java.lang.Override public org.ovirt.engine.core.common.action.VdcActionParametersBase createActionParameters ( org.ovirt.engine.core.common.businessentities.VM vm ) { return new org.ovirt.engine.core.common.action.StopVmParameters ( vm.getId ( ) , org.ovirt.engine.core.common.action.StopVmTypeEnum.NORMAL , model.getReason ( ) . getEntity ( ) ) ; } } ) ; }

Target:
private void onStop ( ) { final org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel ) ( org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel.getWindow ( ) ) ) ; onPowerAction ( VdcActionType.StopVm , new org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel.PowerActionParametersFactory < org.ovirt.engine.core.common.action.VdcActionParametersBase > ( ) { @ java.lang.Override public org.ovirt.engine.core.common.action.VdcActionParametersBase createActionParameters ( org.ovirt.engine.core.common.businessentities.VM vm ) { return new org.ovirt.engine.core.common.action.StopVmParameters ( vm.getId ( ) , org.ovirt.engine.core.common.action.StopVmTypeEnum.NORMAL , model.getReason ( ) . getEntity ( ) ) ; } } ) ; }
Source:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.Model , ? > getModelPopup ( org.ovirt.engine.ui.uicommonweb.models.storage.StorageRegisterVmListModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand , org.ovirt.engine.ui.uicommonweb.models.Model windowModel ) { if ( lastExecutedCommand == ( getModel ( ) . getImportCommand ( ) ) ) { return registerEntityPopupProvider.get ( ) ; } else { return super . getModelPopup ( source , lastExecutedCommand , windowModel ) ; } }

Target:
public org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget < ? extends org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel , ? > getConfirmModelPopup ( org.ovirt.engine.ui.uicommonweb.models.storage.TemplateBackupModel source , org.ovirt.engine.ui.uicommonweb.UICommand lastExecutedCommand ) { if ( lastExecutedCommand == ( getModel ( ) . getRemoveCommand ( ) ) ) { return removeConfirmPopupProvider.get ( ) ; } else if ( ( source.getConfirmWindow ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.storage.ImportCloneModel ) { return importClonePopupProvider.get ( ) ; } else { return super . getConfirmModelPopup ( source , lastExecutedCommand ) ; } }