auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void canDoActionFailsOnNullDiskInterface ( ) throws java.lang.Exception { org.ovirt.engine.core.compat.Guid storageId = org.ovirt.engine.core.compat.Guid.NewGuid ( ) ; org.ovirt.engine.core.common.businessentities.DiskImageBase image = new org.ovirt.engine.core.common.businessentities.DiskImageBase ( ) ; image.setvolume_format ( VolumeFormat.COW ) ; image.setvolume_type ( VolumeType.Preallocated ) ; org.ovirt.engine.core.common.action.AddDiskParameters params = new org.ovirt.engine.core.common.action.AddDiskParameters ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , image ) ; initializeCommand ( storageId , params ) ; org.junit.Assert.assertFalse ( command.validateInputs ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( "VALIDATION.DISK_INTERFACE.NOT_NULL" ) ) ; }

Target:
public void canDoActionFailsOnNullDiskInterface ( ) throws java.lang.Exception { org.ovirt.engine.core.compat.Guid storageId = org.ovirt.engine.core.compat.Guid.NewGuid ( ) ; org.ovirt.engine.core.common.businessentities.DiskImage image = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; image.setvolume_format ( VolumeFormat.COW ) ; image.setvolume_type ( VolumeType.Preallocated ) ; org.ovirt.engine.core.common.action.AddDiskParameters params = new org.ovirt.engine.core.common.action.AddDiskParameters ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , image ) ; initializeCommand ( storageId , params ) ; org.junit.Assert.assertFalse ( command.validateInputs ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( "VALIDATION.DISK_INTERFACE.NOT_NULL" ) ) ; }
Source:
private void setEngineSessionSoftLimit ( java.lang.String engineSessionId , int ttlValue ) throws java.io.IOException , javax.naming.NamingException { javax.naming.InitialContext context = null ; try { context = new javax.naming.InitialContext ( ) ; org.ovirt.engine.core.aaa.filters.FiltersHelper.getBackend ( context ) . runAction ( VdcActionType.SetSesssionSoftLimit , new org.ovirt.engine.core.common.action.SetSesssionSoftLimitCommandParameters ( engineSessionId , ttlValue ) ) ; } finally { try { context.close ( ) ; } catch ( javax.naming.NamingException e ) { org.ovirt.engine.core.aaa.filters.RestApiSessionMgmtFilter.log.error ( ( "Error in REST-API session management. 'Context' object could not be manually closed. " + "This is a cleanup error only; it does not disturb application flow" ) , e ) ; } } }

Target:
private void setEngineSessionSoftLimit ( java.lang.String engineSessionId , int ttlValue ) throws java.io.IOException , javax.naming.NamingException { javax.naming.InitialContext context = new javax.naming.InitialContext ( ) ; try { org.ovirt.engine.core.aaa.filters.FiltersHelper.getBackend ( context ) . runAction ( VdcActionType.SetSesssionSoftLimit , new org.ovirt.engine.core.common.action.SetSesssionSoftLimitCommandParameters ( engineSessionId , ttlValue ) ) ; } finally { try { context.close ( ) ; } catch ( javax.naming.NamingException e ) { org.ovirt.engine.core.aaa.filters.RestApiSessionMgmtFilter.log.error ( ( "Error in REST-API session management. 'Context' object could not be manually closed. " + "This is a cleanup error only; it does not disturb application flow" ) , e ) ; } } }
Source:
public static void initDictionaries ( ) { org.ovirt.engine.core.bll.CpuFlagsManagerHandler.log.info ( "Start initializing dictionaries" ) ; org.ovirt.engine.core.bll.CpuFlagsManagerHandler._managersDictionary.clear ( ) ; for ( org.ovirt.engine.core.compat.Version ver : org.ovirt.engine.core.common.config.Config.< java.util.HashSet < org.ovirt.engine.core.compat.Version > > getValue ( ConfigValues.SupportedClusterLevels ) ) { org.ovirt.engine.core.bll.CpuFlagsManagerHandler._managersDictionary.put ( ver , new org.ovirt.engine.core.bll.CpuFlagsManagerHandler.CpuFlagsManager ( ver ) ) ; } org.ovirt.engine.core.bll.CpuFlagsManagerHandler.log.info ( "Finished initializing dictionaries" ) ; }

Target:
public void initDictionaries ( ) { org.ovirt.engine.core.bll.CpuFlagsManagerHandler.log.info ( "Start initializing dictionaries" ) ; org.ovirt.engine.core.bll.CpuFlagsManagerHandler._managersDictionary.clear ( ) ; for ( org.ovirt.engine.core.compat.Version ver : org.ovirt.engine.core.common.config.Config.< java.util.HashSet < org.ovirt.engine.core.compat.Version > > getValue ( ConfigValues.SupportedClusterLevels ) ) { org.ovirt.engine.core.bll.CpuFlagsManagerHandler._managersDictionary.put ( ver , new org.ovirt.engine.core.bll.CpuFlagsManagerHandler.CpuFlagsManager ( ver ) ) ; } org.ovirt.engine.core.bll.CpuFlagsManagerHandler.log.info ( "Finished initializing dictionaries" ) ; }
Source:
protected java.io.File determineActualFile ( final javax.servlet.http.HttpServletRequest request , java.util.Locale locale ) { java.io.File file = org.ovirt.engine.core.utils.ServletUtils.makeFileFromSanePath ( request.getPathInfo ( ) , base ) ; if ( ( null != file ) && ( ! ( org.ovirt.engine.core.utils.ServletUtils.canReadFile ( file ) ) ) ) { file = org.ovirt.engine.core.utils.ServletUtils.makeFileFromSanePath ( replaceLocaleWithUSLocale ( request.getPathInfo ( ) , locale ) , base ) ; } return file ; }

Target:
protected java.io.File determineActualFile ( final javax.servlet.http.HttpServletRequest request , java.util.Locale locale ) { java.io.File file = org.ovirt.engine.core.utils.ServletUtils.makeFileFromSanePath ( request.getPathInfo ( ) , base ) ; if ( ( file != null ) && ( ! ( org.ovirt.engine.core.utils.ServletUtils.canReadFile ( file ) ) ) ) { file = org.ovirt.engine.core.utils.ServletUtils.makeFileFromSanePath ( replaceLocaleWithUSLocale ( request.getPathInfo ( ) , locale ) , base ) ; } return file ; }
Source:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . 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 ) { updateReportsAvailability ( ) ; } } ) ; performLogin ( loginModel ) ; }

Target:
protected void onLogin ( final org.ovirt.engine.ui.uicommonweb.models.LoginModel loginModel ) { org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . init ( ) ; org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . getReportsInitEvent ( ) . addListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.EventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { updateReportsAvailability ( ) ; } } ) ; performLogin ( loginModel ) ; }
Source:
public java.util.Map < java.lang.String , java.lang.String > getJobMessageProperties ( ) { if ( ( jobProperties ) == null ) { jobProperties = new java.util.HashMap < > ( ) ; jobProperties.put ( VdcObjectType.VM.name ( ) . toLowerCase ( ) , ( ( org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getVmName ( ) ) == null ? "" : org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getVmName ( ) ) ) ; jobProperties.put ( VdcObjectType.Storage.name ( ) . toLowerCase ( ) , org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getStorageDomainName ( ) ) ; } return jobProperties ; }

Target:
public java.util.Map < java.lang.String , java.lang.String > getJobMessageProperties ( ) { if ( ( jobProperties ) == null ) { jobProperties = super . getJobMessageProperties ( ) ; jobProperties.put ( VdcObjectType.VM.name ( ) . toLowerCase ( ) , ( ( org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getVmName ( ) ) == null ? "" : org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getVmName ( ) ) ) ; jobProperties.put ( VdcObjectType.Storage.name ( ) . toLowerCase ( ) , org.ovirt.engine.core.bll.exportimport.RemoveVmFromImportExportCommand.getStorageDomainName ( ) ) ; } return jobProperties ; }
Source:
public void testImportWithClusterName ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ( "Cluster: name=" + ( NAMES [ 1 ] ) ) , SearchType.Cluster , getCluster ( 1 ) ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setId ( GUIDS [ 2 ] . toString ( ) ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setName ( NAMES [ 1 ] ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; doTestImport ( storageDomain , cluster ) ; }

Target:
public void testImportWithClusterName ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ( "Cluster: name=" + ( NAMES [ 1 ] ) ) , SearchType.Cluster , getCluster ( 1 ) ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setId ( GUIDS [ 2 ] . toString ( ) ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setName ( NAMES [ 1 ] ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; doTestImport ( storageDomain , cluster , false ) ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { super . eventRaised ( ev , sender , args ) ; if ( ( ev.matchesDefinition ( HasEntity.entityChangedEventDefinition ) ) && ( sender == ( getPath ( ) ) ) ) { getPathChangedEvent ( ) . raise ( this , EventArgs.EMPTY ) ; } else if ( ( ev.matchesDefinition ( HasEntity.entityChangedEventDefinition ) ) && ( sender == ( getOverride ( ) ) ) ) { override_EntityChanged ( args ) ; } }

Target:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.EventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { super . eventRaised ( ev , sender , args ) ; if ( ( ev.matchesDefinition ( HasEntity.entityChangedEventDefinition ) ) && ( sender == ( getPath ( ) ) ) ) { getPathChangedEvent ( ) . raise ( this , EventArgs.EMPTY ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.VM createVmForTesting ( java.lang.String initrd , java.lang.String kernel ) { mockVm ( command ) ; org.ovirt.engine.core.common.action.RunVmParams runVmParams = command.getParameters ( ) ; runVmParams.setinitrd_url ( initrd ) ; runVmParams.setkernel_url ( kernel ) ; command.createVm ( ) ; org.ovirt.engine.core.common.businessentities.VM vm = vmDAO.get ( command.getParameters ( ) . getVmId ( ) ) ; return vm ; }

Target:
private org.ovirt.engine.core.common.businessentities.VM createVmForTesting ( java.lang.String initrd , java.lang.String kernel ) { mockVm ( command ) ; command.getVm ( ) . setinitrd_url ( initrd ) ; command.getVm ( ) . setkernel_url ( kernel ) ; command.createVm ( ) ; org.ovirt.engine.core.common.businessentities.VM vm = vmDAO.get ( command.getParameters ( ) . getVmId ( ) ) ; return vm ; }
Source:
public void syncNetworkOnMtu ( ) { org.ovirt.engine.core.common.businessentities.Network net = createNetwork ( "net" ) ; net.setMtu ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextInt ( ) ) ; org.ovirt.engine.core.common.businessentities.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net ) ; nic.setMtu ( 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 syncNetworkOnMtu ( ) { org.ovirt.engine.core.common.businessentities.network.Network net = createNetwork ( "net" ) ; net.setMtu ( org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextInt ( ) ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net ) ; nic.setMtu ( 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 ) ; }
Source:
public void storagePoolIdWithStorageDomain ( ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase b = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; b.setStoragePoolId ( null ) ; b.setStoragePool ( null ) ; final org.ovirt.engine.core.common.businessentities.StorageDomain s = new org.ovirt.engine.core.common.businessentities.StorageDomain ( ) ; s.setstorage_pool_id ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID ) ; b.setStorageDomain ( s ) ; final org.ovirt.engine.core.compat.NGuid n = b.getStoragePoolId ( ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID , n ) ; }

Target:
public void storagePoolIdWithStorageDomain ( ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase b = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; b.setStoragePoolId ( null ) ; b.setStoragePool ( null ) ; final org.ovirt.engine.core.common.businessentities.StorageDomain s = new org.ovirt.engine.core.common.businessentities.StorageDomain ( ) ; s.setStoragePoolId ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID ) ; b.setStorageDomain ( s ) ; final org.ovirt.engine.core.compat.NGuid n = b.getStoragePoolId ( ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID , n ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.VMStatus getRawValue ( org.ovirt.engine.core.common.businessentities.VM object ) { final org.ovirt.engine.core.common.businessentities.VDS vds = getDetailModel ( ) . getEntity ( ) ; if ( ( object.getStatus ( ) . equals ( VMStatus.MigratingFrom ) ) && ( vds.getId ( ) . equals ( object.getMigratingToVds ( ) ) ) ) { return org.ovirt.engine.core.common.businessentities.VMStatus.MigratingTo ; } return object.getStatus ( ) ; }

Target:
protected org.ovirt.engine.core.common.businessentities.VMStatus getRawValue ( org.ovirt.engine.core.common.businessentities.VM object ) { final org.ovirt.engine.core.common.businessentities.VDS vds = getDetailModel ( ) . getEntity ( ) ; if ( ( ( object.getStatus ( ) . equals ( VMStatus.MigratingFrom ) ) && ( vds != null ) ) && ( vds.getId ( ) . equals ( object.getMigratingToVds ( ) ) ) ) { return org.ovirt.engine.core.common.businessentities.VMStatus.MigratingTo ; } return object.getStatus ( ) ; }
Source:
public void networkRemovedFromNic ( ) { java.lang.String networkName = "net" ; org.ovirt.engine.core.common.businessentities.VdsNetworkInterface nic = createNic ( "nic0" , networkName ) ; mockExistingIfaces ( nic ) ; nic.setNetworkName ( null ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic ) ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNetworkRemoved ( helper , networkName ) ; assertNoBondsRemoved ( helper ) ; }

Target:
public void networkRemovedFromNic ( ) { java.lang.String networkName = "net" ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNic ( "nic0" , networkName ) ; mockExistingIfaces ( nic ) ; nic.setNetworkName ( null ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic ) ) ; validateAndExpectNoViolations ( helper ) ; assertNoBondsModified ( helper ) ; assertNoNetworksModified ( helper ) ; assertNetworkRemoved ( helper , networkName ) ; assertNoBondsRemoved ( helper ) ; }
Source:
private void mockVdsWithOsVersion ( java.lang.String osVersion ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setVdsType ( VDSType.oVirtVintageNode ) ; vds.setHostOs ( osVersion ) ; org.mockito.Mockito.when ( vdsDao.get ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vds ) ; }

Target:
private void mockVdsWithOsVersion ( java.lang.String osVersion ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setVdsType ( VDSType.oVirtVintageNode ) ; vds.setHostOs ( osVersion ) ; org.mockito.Mockito.when ( vdsDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( vds ) ; }
Source:
protected void initStoragePoolId ( ) { if ( ( org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) ) != null ) { setStoragePoolId ( ( ( org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getStoragePoolId ( ) ) != null ? org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getStoragePoolId ( ) . getValue ( ) : org.ovirt.engine.core.compat.Guid.Empty ) ) ; } }

Target:
protected void initStoragePoolId ( ) { if ( ( org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) ) != null ) { setStoragePoolId ( ( ( org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getStoragePoolId ( ) ) != null ? org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getStoragePoolId ( ) : org.ovirt.engine.core.compat.Guid.Empty ) ) ; } }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.network.ExternalSubnet > getAllSubnets ( org.ovirt.engine.core.common.businessentities.network.ProviderNetwork network ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.ExternalSubnet > result = new java.util.ArrayList < > ( ) ; com.woorea.openstack.quantum.model.Subnets subnets = getClient ( ) . subnets ( ) . list ( ) . execute ( ) ; for ( com.woorea.openstack.quantum.model.Subnet subnet : subnets.getList ( ) ) { if ( network.getExternalId ( ) . equals ( subnet.getNetworkId ( ) ) ) { result.add ( map ( subnet , network ) ) ; } } return result ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.network.ExternalSubnet > getAllSubnets ( org.ovirt.engine.core.common.businessentities.network.ProviderNetwork network ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.ExternalSubnet > result = new java.util.ArrayList < > ( ) ; com.woorea.openstack.quantum.model.Subnets subnets = execute ( getClient ( ) . subnets ( ) . list ( ) ) ; for ( com.woorea.openstack.quantum.model.Subnet subnet : subnets.getList ( ) ) { if ( network.getExternalId ( ) . equals ( subnet.getNetworkId ( ) ) ) { result.add ( map ( subnet , network ) ) ; } } return result ; }
Source:
public boolean Validate ( ) { org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation tempVar = new org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation ( ) ; tempVar.setMinimum ( 1 ) ; tempVar.setMaximum ( 100 ) ; getOverCommitTime ( ) . validateEntity ( new org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] { new org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation ( ) , tempVar } ) ; return getOverCommitTime ( ) . getIsValid ( ) ; }

Target:
public boolean validate ( ) { org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation tempVar = new org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation ( ) ; tempVar.setMinimum ( 1 ) ; tempVar.setMaximum ( 100 ) ; getOverCommitTime ( ) . validateEntity ( new org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] { new org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation ( ) , tempVar } ) ; return getOverCommitTime ( ) . getIsValid ( ) ; }
Source:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpGetDomainExpectations ( StorageType.NFS , false ) ; control.replay ( ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( wae.getResponse ( ) . getStatus ( ) , 404 ) ; } }

Target:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpGetDomainExpectations ( StorageType.NFS , false ) ; control.replay ( ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }
Source:
public void testSelectionRestoredOnNewSetItems ( ) { org.ovirt.engine.ui.uicommonweb.models.SearchableListModel < java.lang.Void , java.lang.Integer > listModel = new org.ovirt.engine.ui.uicommonweb.models.SearchableListModel < java.lang.Void , java.lang.Integer > ( ) { @ java.lang.Override protected java.lang.String getListName ( ) { return "test" ; } } ; listModel.setItems ( java.util.Arrays.asList ( 1 , 2 , 3 ) ) ; listModel.setSelectedItem ( 2 ) ; listModel.setItems ( java.util.Arrays.asList ( 1 , 2 ) ) ; org.junit.Assert.assertEquals ( ( ( java.lang.Integer ) ( 2 ) ) , listModel.getSelectedItem ( ) ) ; }

Target:
public void testSelectionRestoredOnNewSetItems ( ) { listModel.setItems ( java.util.Arrays.asList ( 1 , 2 , 3 ) ) ; listModel.setSelectedItem ( 2 ) ; listModel.setItems ( java.util.Arrays.asList ( 1 , 2 ) ) ; org.junit.Assert.assertEquals ( ( ( java.lang.Integer ) ( 2 ) ) , listModel.getSelectedItem ( ) ) ; }
Source:
protected void ExecuteVmCommand ( ) { org.ovirt.engine.core.bll.ImagesHandler.setDiskAlias ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) , org.ovirt.engine.core.bll.AddDiskCommand.getVm ( ) ) ; if ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) == ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) . getDiskStorageType ( ) ) ) { setAllowSnapshotForDisk ( ) ; createDiskBasedOnImage ( ) ; } else { createDiskBasedOnLun ( ) ; } }

Target:
protected void ExecuteVmCommand ( ) { org.ovirt.engine.core.bll.ImagesHandler.setDiskAlias ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) , org.ovirt.engine.core.bll.AddDiskCommand.getVm ( ) ) ; if ( ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) == ( org.ovirt.engine.core.bll.AddDiskCommand.getParameters ( ) . getDiskInfo ( ) . getDiskStorageType ( ) ) ) { createDiskBasedOnImage ( ) ; } else { createDiskBasedOnLun ( ) ; } }
Source:
public void testAddIdSuppliedButNoName ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Network model = new org.ovirt.engine.api.model.Network ( ) ; model.setId ( "11111111-1111-1111-1111-111111111111" ) ; setUpEntityQueryExpectations ( 1 , null ) ; setUpGetClusterExpectations ( 1 ) ; setUpGetNetworksByDataCenterExpectations ( 1 , null ) ; setUpClusterExpectations ( org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID ) ; setUpActionExpectations ( VdcActionType.AttachNetworkToCluster , org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter.class , new java.lang.String [ ] { "ClusterId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID } , true , true ) ; collection.add ( model ) ; }

Target:
public void testAddIdSuppliedButNoName ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.Network model = new org.ovirt.engine.api.model.Network ( ) ; model.setId ( "11111111-1111-1111-1111-111111111111" ) ; setUpEntityQueryExpectations ( 1 , null ) ; setUpGetNetworksByDataCenterExpectations ( 1 , null ) ; setUpClusterExpectations ( org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID ) ; setUpActionExpectations ( VdcActionType.AttachNetworkToCluster , org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter.class , new java.lang.String [ ] { "ClusterId" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResourceTest.CLUSTER_ID } , true , true ) ; collection.add ( model ) ; }
Source:
public java.util.Map < java.lang.String , java.lang.String > getPeers ( java.lang.String server , java.lang.String username , java.lang.String password , java.lang.String fingerprint ) throws java.io.IOException , javax.naming.AuthenticationException { try ( final org.ovirt.engine.core.uutils.ssh.SSHClient client = getSSHClient ( ) ) { connect ( client , server ) ; authenticate ( client , username , password ) ; java.lang.String serversXml = executePeerStatusCommand ( client ) ; return getFingerprints ( extractServers ( serversXml ) ) ; } }

Target:
public java.util.Map < java.lang.String , java.lang.String > getPeers ( java.lang.String server , java.lang.String username , java.lang.String password , java.lang.String fingerprint ) throws java.io.IOException , javax.naming.AuthenticationException { try ( final org.ovirt.engine.core.uutils.ssh.SSHClient client = getSSHClient ( ) ) { connect ( client , server , username , password ) ; authenticate ( client ) ; java.lang.String serversXml = executePeerStatusCommand ( client ) ; return getFingerprints ( extractServers ( serversXml ) ) ; } }
Source:
protected org.ovirt.engine.core.common.job.Step addSubStep ( org.ovirt.engine.core.common.job.StepEnum parentStep , org.ovirt.engine.core.common.job.StepEnum newStep , java.lang.String description ) { return org.ovirt.engine.core.bll.job.ExecutionHandler.addSubStep ( getExecutionContext ( ) , getExecutionContext ( ) . getJob ( ) . getStep ( parentStep ) , newStep , description ) ; }

Target:
protected org.ovirt.engine.core.common.job.Step addSubStep ( org.ovirt.engine.core.common.job.StepEnum parentStep , org.ovirt.engine.core.common.job.StepEnum newStep , java.lang.String description ) { return org.ovirt.engine.core.bll.job.ExecutionHandler.addSubStep ( getExecutionContext ( ) , ( ( getExecutionContext ( ) . getJob ( ) ) != null ? getExecutionContext ( ) . getJob ( ) . getStep ( parentStep ) : getExecutionContext ( ) . getStep ( ) ) , newStep , description ) ; }
Source:
private static void assertFailsWithCanDoActionMessage ( org.ovirt.engine.core.bll.hostdeploy.UpgradeOvirtNodeInternalCommand < org.ovirt.engine.core.common.action.hostdeploy.InstallVdsParameters > command , org.ovirt.engine.core.common.errors.VdcBllMessages message ) { org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( message.name ( ) ) ) ; }

Target:
private static void assertFailsWithCanDoActionMessage ( org.ovirt.engine.core.bll.hostdeploy.UpgradeOvirtNodeInternalCommand < org.ovirt.engine.core.common.action.hostdeploy.InstallVdsParameters > command , org.ovirt.engine.core.common.errors.EngineMessage message ) { org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( message.name ( ) ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { java.util.HashMap < java.lang.Boolean , org.ovirt.engine.core.common.businessentities.VmTemplate > map = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue ) ) . getReturnValue ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > templates = new java.util.ArrayList < > ( ) ; templates.add ( map.get ( true ) ) ; setItems ( templates ) ; }

Target:
public void onSuccess ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue ) { java.util.HashMap < java.lang.Boolean , org.ovirt.engine.core.common.businessentities.VmTemplate > map = returnValue.getReturnValue ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VmTemplate > templates = new java.util.ArrayList < > ( ) ; templates.add ( map.get ( true ) ) ; setItems ( templates ) ; }
Source:
public void validateSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" , null ) ) ) , null ) ) ; prepareMocks ( cmd , VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }

Target:
public void validateSucceeds ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" , null ) ) ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
public void remove ( final org.ovirt.engine.core.compat.Guid commandId ) { commandMap.remove ( commandId ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( TransactionScopeOption.Required , new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Object > ( ) { @ java.lang.Override public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getCommandEntityDao ( ) . remove ( commandId ) ; return null ; } } ) ; }

Target:
public void remove ( final org.ovirt.engine.core.compat.Guid commandId ) { commandMap.remove ( commandId ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getCommandEntityDao ( ) . remove ( commandId ) ; }
Source:
void bindInfrastructure ( ) { bindCommonInfrastructure ( org.ovirt.engine.ui.userportal.place.UserPortalPlaceManager.class ) ; bind ( org.ovirt.engine.ui.userportal.auth.LoggedInExtendedPlaceGatekeeper.class ) . in ( com.google.inject.Singleton.class ) ; bind ( org.ovirt.engine.ui.uicommonweb.auth.CurrentUserRole.class ) . in ( com.google.inject.Singleton.class ) ; bind ( org.ovirt.engine.ui.userportal.system.ApplicationInit.class ) . asEagerSingleton ( ) ; bindTypeAndImplAsSingleton ( org.ovirt.engine.ui.uicommonweb.auth.CurrentUserRole.class , org.ovirt.engine.ui.userportal.auth.UserPortalCurrentUserRole.class ) ; }

Target:
void bindInfrastructure ( ) { bindCommonInfrastructure ( org.ovirt.engine.ui.userportal.place.UserPortalPlaceManager.class ) ; bind ( org.ovirt.engine.ui.userportal.auth.LoggedInExtendedPlaceGatekeeper.class ) . in ( com.google.inject.Singleton.class ) ; bindTypeAndImplAsSingleton ( org.ovirt.engine.ui.uicommonweb.auth.CurrentUserRole.class , org.ovirt.engine.ui.userportal.auth.UserPortalCurrentUserRole.class ) ; }
Source:
public void migrateVM ( java.util.ArrayList < org.ovirt.engine.core.compat.Guid > initialHosts , org.ovirt.engine.core.compat.Guid vmToMigrate ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vmToMigrate ) ; parameters.setInitialHosts ( initialHosts ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.MigrateVm , parameters , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }

Target:
public void migrateVM ( java.util.List < org.ovirt.engine.core.compat.Guid > initialHosts , org.ovirt.engine.core.compat.Guid vmToMigrate ) { org.ovirt.engine.core.common.action.MigrateVmParameters parameters = new org.ovirt.engine.core.common.action.MigrateVmParameters ( false , vmToMigrate ) ; parameters.setInitialHosts ( new java.util.ArrayList < org.ovirt.engine.core.compat.Guid > ( initialHosts ) ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.MigrateVm , parameters , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }
Source:
public java.util.List < org.ovirt.api.metamodel.concepts.Attribute > getAttributes ( ) { java.util.List < org.ovirt.api.metamodel.concepts.Attribute > result = new java.util.ArrayList ( attributes ) ; if ( ( ( base ) != null ) && ( ( base ) instanceof org.ovirt.api.metamodel.concepts.StructType ) ) { result.addAll ( ( ( org.ovirt.api.metamodel.concepts.StructType ) ( base ) ) . getAttributes ( ) ) ; } result.sort ( java.util.Comparator.comparing ( Attribute :: getName ) ) ; return result ; }

Target:
public java.util.List < org.ovirt.api.metamodel.concepts.Attribute > getAttributes ( ) { java.util.List < org.ovirt.api.metamodel.concepts.Attribute > result = new java.util.ArrayList ( attributes ) ; if ( ( ( base ) != null ) && ( ( base ) instanceof org.ovirt.api.metamodel.concepts.StructType ) ) { result.addAll ( ( ( org.ovirt.api.metamodel.concepts.StructType ) ( base ) ) . getAttributes ( ) ) ; } return result ; }
Source:
protected void initializeCommand ( org.ovirt.engine.core.common.businessentities.ImageOperation operation ) { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.MoveOrCopyDiskCommandTest.MoveOrCopyDiskCommandDummy ( new org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters ( diskImageGuid , srcStorageId , destStorageId , operation ) ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . checkImageConfiguration ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.MoveOrCopyDiskCommandTest.mockStorageDomainValidatorWithSpace ( ) ) . when ( command ) . createStorageDomainValidator ( ) ; org.mockito.Mockito.doReturn ( false ) . when ( command ) . acquireLock ( ) ; }

Target:
protected void initializeCommand ( org.ovirt.engine.core.common.businessentities.ImageOperation operation ) { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.MoveOrCopyDiskCommandTest.MoveOrCopyDiskCommandDummy ( new org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters ( diskImageGuid , srcStorageId , destStorageId , operation ) ) ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.MoveOrCopyDiskCommandTest.mockStorageDomainValidatorWithSpace ( ) ) . when ( command ) . createStorageDomainValidator ( ) ; org.mockito.Mockito.doReturn ( false ) . when ( command ) . acquireLock ( ) ; }
Source:
private void updateSpiceUsbAutoShare ( final org.ovirt.engine.ui.uicommonweb.models.vms.ISpice spice ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getSpiceUsbAutoShare ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { spice.setUsbAutoShare ( ( ( java.lang.Boolean ) ( returnValue ) ) ) ; } } ) ) ; }

Target:
private void updateSpiceUsbAutoShare ( final org.ovirt.engine.ui.uicommonweb.models.vms.ISpice spice ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getSpiceUsbAutoShare ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { spice.setUsbAutoShare ( ( ( java.lang.Boolean ) ( returnValue ) ) ) ; } } ) ) ; }
Source:
private void setUpDaoMocks ( ) { snapshotDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.SnapshotDao.class ) ; org.mockito.Mockito.doReturn ( snapshotDaoMock ) . when ( getQuery ( ) ) . getSnapshotDao ( ) ; org.mockito.Mockito.when ( snapshotDaoMock.get ( existingSnapshotId , getUser ( ) . getId ( ) , getQueryParameters ( ) . isFiltered ( ) ) ) . thenReturn ( existingSnapshot ) ; }

Target:
private void setUpDaoMocks ( ) { org.mockito.Mockito.when ( snapshotDaoMock.get ( existingSnapshotId , getUser ( ) . getId ( ) , getQueryParameters ( ) . isFiltered ( ) ) ) . thenReturn ( existingSnapshot ) ; }
Source:
private void prepareMocks ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommand command ) { org.mockito.Mockito.doReturn ( volumeDao ) . when ( command ) . getGlusterVolumeDao ( ) ; org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ; org.mockito.Mockito.doReturn ( null ) . when ( volumeDao ) . getById ( null ) ; }

Target:
private void prepareMocks ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommand command ) { org.mockito.Mockito.doReturn ( volumeDao ) . when ( command ) . getGlusterVolumeDao ( ) ; org.mockito.Mockito.doReturn ( getVds ( VDSStatus.Up ) ) . when ( command ) . getUpServer ( ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STOPPED_VOLUME_ID ) ; org.mockito.Mockito.doReturn ( getGlusterVolume ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ) . when ( volumeDao ) . getById ( org.ovirt.engine.core.bll.gluster.StopGlusterVolumeProfileCommandTest.STARTED_VOLUME_ID ) ; }
Source:
private java.util.List < java.lang.String > getAvailableKeys ( ) { java.util.List < java.lang.String > list = ( ( allKeys ) == null ) ? new java.util.LinkedList < java.lang.String > ( ) : new java.util.LinkedList < > ( allKeys ) ; list.removeAll ( getUsedKeys ( ) ) ; if ( ( list.size ( ) ) > 0 ) { list.add ( 0 , selectKey ) ; } else { list.add ( noKeys ) ; } return list ; }

Target:
protected java.util.List < java.lang.String > getAvailableKeys ( ) { java.util.List < java.lang.String > list = ( ( allKeys ) == null ) ? new java.util.LinkedList < java.lang.String > ( ) : new java.util.LinkedList < java.lang.String > ( allKeys ) ; list.removeAll ( getUsedKeys ( ) ) ; if ( ( list.size ( ) ) > 0 ) { list.add ( 0 , selectKey ) ; } else { list.add ( noKeys ) ; } return list ; }
Source:
public void validateVmIsNotDown ( ) throws java.lang.Exception { initializeCommand ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initSnapshotValidator ( ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( StorageType.NFS ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN.toString ( ) ) ) ; }

Target:
public void validateVmIsNotDown ( ) throws java.lang.Exception { initializeCommand ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; initSrcStorageDomain ( ) ; initDestStorageDomain ( StorageType.NFS ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN.toString ( ) ) ) ; }
Source:
private void prepareMocks ( org.ovirt.engine.core.bll.gluster.ManageGlusterServiceCommand command ) { org.mockito.Mockito.doReturn ( serverServiceDao ) . when ( command ) . getGlusterServerServiceDao ( ) ; org.mockito.Mockito.doReturn ( serviceDao ) . when ( command ) . getGlusterServiceDao ( ) ; org.mockito.Mockito.doReturn ( glusterUtils ) . when ( command ) . getGlusterUtils ( ) ; org.mockito.Mockito.doReturn ( vdsBrokerFrontend ) . when ( command ) . getVdsBroker ( ) ; org.mockito.Mockito.doReturn ( getUpServers ( ) ) . when ( glusterUtils ) . getAllUpServers ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; }

Target:
private void prepareMocks ( org.ovirt.engine.core.bll.gluster.ManageGlusterServiceCommand command ) { org.mockito.Mockito.doReturn ( glusterUtils ) . when ( command ) . getGlusterUtils ( ) ; org.mockito.Mockito.doReturn ( getUpServers ( ) ) . when ( glusterUtils ) . getAllUpServers ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; }
Source:
public void appendCustomValue ( ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase b = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.TestAuditLogableBase ( ) ; final java.lang.String key = "foo" ; final java.lang.String value = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.NAME ; final java.lang.String sep = "_" ; b.appendCustomValue ( key , value , sep ) ; final java.lang.String s = b.getCustomValue ( key ) ; org.junit.Assert.assertEquals ( value , s ) ; }

Target:
public void appendCustomValue ( ) { final java.lang.String key = "foo" ; final java.lang.String value = org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.NAME ; final java.lang.String sep = "_" ; b.appendCustomValue ( key , value , sep ) ; final java.lang.String s = b.getCustomValue ( key ) ; org.junit.Assert.assertEquals ( value , s ) ; }
Source:
private static void testParseLunFromXmlRpcForDevtypeField ( org.ovirt.engine.core.common.businessentities.StorageType expectedStorageType , java.lang.String mockDevtype ) { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct xlun = org.mockito.Mockito.mock ( org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct.class ) ; org.mockito.Mockito.when ( xlun.contains ( GetDeviceListVDSCommand.DEVTYPE_FIELD ) ) . thenReturn ( true ) ; org.mockito.Mockito.when ( xlun.getItem ( GetDeviceListVDSCommand.DEVTYPE_FIELD ) ) . thenReturn ( mockDevtype ) ; org.ovirt.engine.core.common.businessentities.LUNs lun = org.ovirt.engine.core.vdsbroker.vdsbroker.GetDeviceListVDSCommand.ParseLunFromXmlRpc ( xlun ) ; org.junit.Assert.assertEquals ( expectedStorageType , lun.getLunType ( ) ) ; }

Target:
private static void testParseLunFromXmlRpcForDevtypeField ( org.ovirt.engine.core.common.businessentities.StorageType expectedStorageType , java.lang.String mockDevtype ) { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct xlun = new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct ( ) ; xlun.add ( GetDeviceListVDSCommand.DEVTYPE_FIELD , mockDevtype ) ; org.ovirt.engine.core.common.businessentities.LUNs lun = org.ovirt.engine.core.vdsbroker.vdsbroker.GetDeviceListVDSCommand.ParseLunFromXmlRpc ( xlun ) ; org.junit.Assert.assertEquals ( expectedStorageType , lun.getLunType ( ) ) ; }
Source:
public boolean isValid ( java.lang.Integer value , javax.validation.ConstraintValidatorContext context ) { final java.util.List < java.lang.String > validValues = org.ovirt.engine.core.common.config.Config.< java.util.List < java.lang.String > > GetValue ( ConfigValues.ValidNumOfMonitors ) ; if ( ( value == null ) || ( validValues == null ) ) { return false ; } return validValues.contains ( value.toString ( ) ) ; }

Target:
public boolean isValid ( java.lang.Integer value , javax.validation.ConstraintValidatorContext context ) { final java.util.List < java.lang.String > validValues = org.ovirt.engine.core.common.config.Config.< java.util.List < java.lang.String > > getValue ( ConfigValues.ValidNumOfMonitors ) ; if ( ( value == null ) || ( validValues == null ) ) { return false ; } return validValues.contains ( value.toString ( ) ) ; }
Source:
protected void verifyCollection ( java.util.List < org.ovirt.engine.api.model.File > collection ) throws java.lang.Exception { assertNotNull ( collection ) ; assertEquals ( ( ( NAMES.length ) * 2 ) , collection.size ( ) ) ; for ( int i = 0 ; i < ( NAMES.length ) ; i ++ ) { verifyModel ( collection.get ( i ) , i ) ; } }

Target:
protected void verifyCollection ( java.util.List < org.ovirt.engine.api.model.File > collection ) throws java.lang.Exception { assertNotNull ( collection ) ; assertEquals ( NAMES.length , collection.size ( ) ) ; for ( int i = 0 ; i < ( NAMES.length ) ; i ++ ) { verifyModel ( collection.get ( i ) , i ) ; } }
Source:
protected boolean performImagesChecks ( org.ovirt.engine.core.common.businessentities.VM vm ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( vm , org.ovirt.engine.core.bll.AddDiskCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , vm.getstorage_pool_id ( ) , getStorageDomainId ( ) . getValue ( ) , false , true , false , false , true , false , false , true , java.util.Collections.emptyList ( ) ) ; }

Target:
protected boolean performImagesChecks ( org.ovirt.engine.core.common.businessentities.VM vm ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( vm , org.ovirt.engine.core.bll.AddDiskCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , vm.getStoragePoolId ( ) , getStorageDomainId ( ) . getValue ( ) , false , true , false , false , true , false , false , true , java.util.Collections.emptyList ( ) ) ; }
Source:
public java.lang.Object lookupEntity ( java.lang.Object id ) throws org.ovirt.engine.api.restapi.resource.BackendFailureException { org.ovirt.engine.core.common.businessentities.VM vm = doGetEntity ( org.ovirt.engine.core.common.businessentities.VM.class , query , getQueryParams ( queryParamsClass , id ) , id.toString ( ) ) ; org.ovirt.engine.api.restapi.resource.Vm model = new org.ovirt.engine.api.restapi.resource.Vm ( ) ; model.setId ( vm.getId ( ) . toString ( ) ) ; return org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( getUriInfo ( ) , model ) ; }

Target:
public java.lang.Object lookupEntity ( java.lang.Object id ) throws org.ovirt.engine.api.restapi.resource.BackendFailureException { org.ovirt.engine.core.common.businessentities.VM vm = doGetEntity ( org.ovirt.engine.core.common.businessentities.VM.class , query , getQueryParams ( queryParamsClass , id ) , id.toString ( ) ) ; org.ovirt.engine.api.restapi.resource.Vm model = new org.ovirt.engine.api.restapi.resource.Vm ( ) ; model.setId ( vm.getId ( ) . toString ( ) ) ; return org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( model ) ; }
Source:
private boolean isCurrentTaskLookedFor ( org.ovirt.engine.core.compat.Guid id , org.ovirt.engine.core.bll.tasks.interfaces.SPMTask task ) { return ( ( ( task instanceof org.ovirt.engine.core.bll.tasks.CommandAsyncTask ) && ( id.equals ( task.getParameters ( ) . getEntityInfo ( ) . getId ( ) ) ) ) && ( ( task.getState ( ) ) != ( AsyncTaskState.Cleared ) ) ) && ( ( task.getState ( ) ) != ( AsyncTaskState.ClearFailed ) ) ; }

Target:
private boolean isCurrentTaskLookedFor ( org.ovirt.engine.core.compat.Guid id , org.ovirt.engine.core.bll.tasks.interfaces.SPMTask task ) { return ( ( ( ( task instanceof org.ovirt.engine.core.bll.tasks.CommandAsyncTask ) && ( ( task.getParameters ( ) . getEntityInfo ( ) ) != null ) ) && ( id.equals ( task.getParameters ( ) . getEntityInfo ( ) . getId ( ) ) ) ) && ( ( task.getState ( ) ) != ( AsyncTaskState.Cleared ) ) ) && ( ( task.getState ( ) ) != ( AsyncTaskState.ClearFailed ) ) ; }
Source:
public org.ovirt.engine.core.common.businessentities.StoragePool getStoragePool ( ) { if ( ( ( ( _storagePool ) == null ) && ( ( getStoragePoolId ( ) ) != null ) ) && ( ! ( Guid.Empty.equals ( getStoragePoolId ( ) ) ) ) ) { _storagePool = getStoragePoolDAO ( ) . get ( getStoragePoolId ( ) . getValue ( ) ) ; } return _storagePool ; }

Target:
public org.ovirt.engine.core.common.businessentities.StoragePool getStoragePool ( ) { if ( ( ( ( _storagePool ) == null ) && ( ( getStoragePoolId ( ) ) != null ) ) && ( ! ( Guid.Empty.equals ( getStoragePoolId ( ) ) ) ) ) { _storagePool = getStoragePoolDAO ( ) . get ( getStoragePoolId ( ) ) ; } return _storagePool ; }