auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static org.ovirt.engine.api.model.Link createLink ( java.lang.String url , java.lang.String rel , java.util.List < org.ovirt.engine.api.model.ParametersSet > params ) { org.ovirt.engine.api.model.Link link = new org.ovirt.engine.api.model.Link ( ) ; link.setRel ( ( rel + ( org.ovirt.engine.api.common.util.LinkHelper.SEARCH_RELATION ) ) ) ; link.setHref ( org.ovirt.engine.api.common.util.LinkHelper.combine ( ( url + ( org.ovirt.engine.api.common.util.LinkHelper.SEARCH_TEMPLATE ) ) , params ) ) ; return link ; }

Target:
public static org.ovirt.engine.api.model.Link createLink ( java.lang.String url , java.lang.String rel , java.util.List < org.ovirt.engine.api.model.ParametersSet > params ) { org.ovirt.engine.api.model.Link link = new org.ovirt.engine.api.model.Link ( ) ; link.setRel ( ( rel + ( org.ovirt.engine.api.common.util.LinkHelper.SEARCH_RELATION ) ) ) ; link.setHref ( ( ( org.ovirt.engine.api.common.util.LinkHelper.combine ( url , params ) ) + ( org.ovirt.engine.api.common.util.LinkHelper.SEARCH_TEMPLATE ) ) ) ; return link ; }
Source:
public void OnSuccess ( java.lang.Object target2 , java.lang.Object returnValue2 ) { java.lang.Object [ ] array2 = ( ( java.lang.Object [ ] ) ( target2 ) ) ; org.ovirt.engine.ui.uicommonweb.models.storage.StorageDataCenterListModel listModel2 = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.StorageDataCenterListModel ) ( array2 [ 0 ] ) ) ; org.ovirt.engine.core.common.businessentities.storage_pool dataCenter2 = ( ( org.ovirt.engine.core.common.businessentities.storage_pool ) ( array2 [ 1 ] ) ) ; boolean addDatacenter2 = ( ( dataCenter2.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StoragePoolStatus.Up ) ) && ( returnValue2 == null ) ; listModel2.AddToAttachCandidateDatacenters ( dataCenter2 , addDatacenter2 ) ; }

Target:
public void onSuccess ( java.lang.Object target2 , java.lang.Object returnValue2 ) { java.lang.Object [ ] array2 = ( ( java.lang.Object [ ] ) ( target2 ) ) ; org.ovirt.engine.ui.uicommonweb.models.storage.StorageDataCenterListModel listModel2 = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.StorageDataCenterListModel ) ( array2 [ 0 ] ) ) ; org.ovirt.engine.core.common.businessentities.storage_pool dataCenter2 = ( ( org.ovirt.engine.core.common.businessentities.storage_pool ) ( array2 [ 1 ] ) ) ; boolean addDatacenter2 = ( ( dataCenter2.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StoragePoolStatus.Up ) ) && ( returnValue2 == null ) ; listModel2.AddToAttachCandidateDatacenters ( dataCenter2 , addDatacenter2 ) ; }
Source:
protected void actualSave ( ) { flush ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runAction ( action , new org.ovirt.engine.core.common.action.ProviderParameters ( provider ) , new org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { if ( ( ( result.getReturnValue ( ) ) == null ) || ( ! ( result.getReturnValue ( ) . getSucceeded ( ) ) ) ) { return ; } sourceListModel.getSearchCommand ( ) . execute ( ) ; cancel ( ) ; } } ) ; }

Target:
protected void actualSave ( ) { flush ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runAction ( action , new org.ovirt.engine.core.common.action.ProviderParameters ( provider ) , new org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult result ) { if ( ( ( result.getReturnValue ( ) ) == null ) || ( ! ( result.getReturnValue ( ) . getSucceeded ( ) ) ) ) { return ; } sourceListModel.getSearchCommand ( ) . execute ( ) ; cancel ( ) ; } } , this ) ; }
Source:
public void testAlreadyExistStorageDomain ( ) { org.mockito.Mockito.when ( storageDomainStaticDao.get ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.storage.domain.AddExistingBlockStorageDomainCommandTest.getStorageDomain ( ) ) ; org.junit.Assert.assertFalse ( "Storage Domain already exists" , command.canAddDomain ( ) ) ; org.junit.Assert.assertTrue ( "Import block Storage Domain should have failed due to already existing Storage Domain" , command.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST.toString ( ) ) ) ; }

Target:
public void testAlreadyExistStorageDomain ( ) { org.mockito.Mockito.when ( storageDomainStaticDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.storage.domain.AddExistingBlockStorageDomainCommandTest.getStorageDomain ( ) ) ; org.junit.Assert.assertFalse ( "Storage Domain already exists" , command.canAddDomain ( ) ) ; org.junit.Assert.assertTrue ( "Import block Storage Domain should have failed due to already existing Storage Domain" , command.getReturnValue ( ) . getValidationMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST.toString ( ) ) ) ; }
Source:
protected java.util.Map < java.lang.String , org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.lang.String > > getExclusiveLocks ( ) { if ( ! ( org.apache.commons.lang.StringUtils.isBlank ( getParameters ( ) . getVm ( ) . getName ( ) ) ) ) { return java.util.Collections.singletonMap ( getParameters ( ) . getVm ( ) . getName ( ) , org.ovirt.engine.core.bll.LockMessagesMatchUtil.makeLockingPair ( LockingGroup.VM_NAME , VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED ) ) ; } return null ; }

Target:
protected java.util.Map < java.lang.String , org.ovirt.engine.core.common.utils.Pair < java.lang.String , java.lang.String > > getExclusiveLocks ( ) { if ( ( ( getParameters ( ) . getVm ( ) ) != null ) && ( ! ( org.apache.commons.lang.StringUtils.isBlank ( getParameters ( ) . getVm ( ) . getName ( ) ) ) ) ) { return java.util.Collections.singletonMap ( getParameters ( ) . getVm ( ) . getName ( ) , org.ovirt.engine.core.bll.LockMessagesMatchUtil.makeLockingPair ( LockingGroup.VM_NAME , VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED ) ) ; } return null ; }
Source:
protected void addUsersToModel ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue , java.util.Set < org.ovirt.engine.core.common.utils.ExternalId > excludeUsers ) { for ( org.ovirt.engine.core.common.businessentities.IVdcQueryable item : ( ( java.util.List < org.ovirt.engine.core.common.businessentities.IVdcQueryable > ) ( returnValue.getReturnValue ( ) ) ) ) { org.ovirt.engine.core.aaa.DirectoryUser a = ( ( org.ovirt.engine.core.aaa.DirectoryUser ) ( item ) ) ; if ( ! ( excludeUsers.contains ( a.getId ( ) ) ) ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel tempVar2 = new org.ovirt.engine.ui.uicommonweb.models.EntityModel ( ) ; tempVar2.setEntity ( new org.ovirt.engine.core.common.businessentities.DbUser ( a ) ) ; getusers ( ) . add ( tempVar2 ) ; } } }

Target:
protected void addUsersToModel ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue , java.util.Set < java.lang.String > excludeUsers ) { for ( org.ovirt.engine.core.common.businessentities.IVdcQueryable item : ( ( java.util.List < org.ovirt.engine.core.common.businessentities.IVdcQueryable > ) ( returnValue.getReturnValue ( ) ) ) ) { org.ovirt.engine.core.aaa.DirectoryUser a = ( ( org.ovirt.engine.core.aaa.DirectoryUser ) ( item ) ) ; if ( ! ( excludeUsers.contains ( a.getId ( ) ) ) ) { org.ovirt.engine.ui.uicommonweb.models.EntityModel tempVar2 = new org.ovirt.engine.ui.uicommonweb.models.EntityModel ( ) ; tempVar2.setEntity ( new org.ovirt.engine.core.common.businessentities.DbUser ( a ) ) ; getusers ( ) . add ( tempVar2 ) ; } } }
Source:
public org.ovirt.engine.core.bll.network.macpool.MacPool createDecoratedPool ( org.ovirt.engine.core.compat.Guid macPoolId , org.ovirt.engine.core.bll.network.macpool.MacPool macPool , java.util.List < org.ovirt.engine.core.bll.network.macpool.MacPoolDecorator > decorators ) { org.ovirt.engine.core.bll.network.macpool.MacPool lockedPool = lockedObjectFactory.createLockingInstance ( macPool , org.ovirt.engine.core.bll.network.macpool.MacPool.class , lockForMacPool ( macPoolId ) ) ; org.ovirt.engine.core.bll.network.macpool.MacPool decoratedPool = decoratePool ( macPoolId , lockedPool , decorators ) ; return decoratedPool ; }

Target:
public org.ovirt.engine.core.bll.network.macpool.MacPool createDecoratedPool ( org.ovirt.engine.core.bll.network.macpool.MacPool macPool , java.util.List < org.ovirt.engine.core.bll.network.macpool.MacPoolDecorator > decorators ) { org.ovirt.engine.core.bll.network.macpool.MacPool lockedPool = lockedObjectFactory.createLockingInstance ( macPool , org.ovirt.engine.core.bll.network.macpool.MacPool.class , lockForMacPool ( macPool.getId ( ) ) ) ; org.ovirt.engine.core.bll.network.macpool.MacPool decoratedPool = decoratePool ( lockedPool , decorators ) ; return decoratedPool ; }
Source:
public void testValueCaps ( ) { org.ovirt.engine.core.searchbackend.IAutoCompleter comp = new org.ovirt.engine.core.searchbackend.BitValueAutoCompleter ( ) ; java.util.List < java.lang.String > comps = java.util.Arrays.asList ( comp.getCompletion ( "FA" ) ) ; org.junit.Assert.assertTrue ( "false" , comps.contains ( "false" ) ) ; org.junit.Assert.assertTrue ( "true" , ( ! ( comps.contains ( "true" ) ) ) ) ; }

Target:
public void testValueCaps ( ) { java.util.List < java.lang.String > comps = java.util.Arrays.asList ( comp.getCompletion ( "FA" ) ) ; org.junit.Assert.assertTrue ( "false" , comps.contains ( "false" ) ) ; org.junit.Assert.assertTrue ( "true" , ( ! ( comps.contains ( "true" ) ) ) ) ; }
Source:
private java.io.File createTempPng ( ) { try { java.io.File file = java.io.File.createTempFile ( "favicon" , ".png" ) ; file.deleteOnExit ( ) ; java.awt.image.BufferedImage img = new java.awt.image.BufferedImage ( 256 , 256 , java.awt.image.BufferedImage.TYPE_INT_RGB ) ; if ( ! ( javax.imageio.ImageIO.write ( img , "PNG" , file ) ) ) { org.junit.Assert.fail ( "Unable to write temporary image file" ) ; } return file ; } catch ( java.io.IOException ioe ) { org.junit.Assert.fail ( ( "IOException thrown: " + ( ioe.getMessage ( ) ) ) ) ; return null ; } }

Target:
private java.io.File createTempPng ( ) throws java.io.IOException { java.io.File file = java.io.File.createTempFile ( "favicon" , ".png" ) ; file.deleteOnExit ( ) ; java.awt.image.BufferedImage img = new java.awt.image.BufferedImage ( 256 , 256 , java.awt.image.BufferedImage.TYPE_INT_RGB ) ; if ( ! ( javax.imageio.ImageIO.write ( img , "PNG" , file ) ) ) { org.junit.Assert.fail ( "Unable to write temporary image file" ) ; } return file ; }
Source:
public void testAddStorageDomainNoHost ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; org.ovirt.engine.api.model.StorageDomain model = org.ovirt.engine.api.restapi.resource.BackendStorageDomainsResourceTest.getModel ( 0 ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "StorageDomain" , "add" , "host.id|name" ) ; } }

Target:
public void testAddStorageDomainNoHost ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; org.ovirt.engine.api.model.StorageDomain model = org.ovirt.engine.api.restapi.resource.BackendStorageDomainsResourceTest.getModel ( 0 ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "StorageDomain" , "add" , "host.id|name" ) ; } }
Source:
public void onFailure ( java.lang.Throwable caught ) { if ( org.ovirt.engine.ui.frontend.Frontend.ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to execute RunQuery: " + caught ) , caught ) ; org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) . runQueryFailed ( null ) ; org.ovirt.engine.ui.frontend.Frontend.failureEventHandler ( caught ) ; if ( callback.isHandleFailure ( ) ) { callback.asyncCallback.OnSuccess ( callback.getModel ( ) , null ) ; } }

Target:
public void onFailure ( java.lang.Throwable caught ) { if ( org.ovirt.engine.ui.frontend.Frontend.ignoreFailure ( caught ) ) { return ; } org.ovirt.engine.ui.frontend.Frontend.logger.log ( java.util.logging.Level.SEVERE , ( "Failed to execute RunQuery: " + caught ) , caught ) ; org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) . runQueryFailed ( null ) ; org.ovirt.engine.ui.frontend.Frontend.failureEventHandler ( caught ) ; if ( callback.isHandleFailure ( ) ) { callback.asyncCallback.onSuccess ( callback.getModel ( ) , null ) ; } }
Source:
public void OnSuccess ( java.lang.Object model1 , java.lang.Object ReturnValue1 ) { org.ovirt.engine.ui.uicommonweb.models.pools.PoolGeneralModel poolGeneralModel1 = ( ( org.ovirt.engine.ui.uicommonweb.models.pools.PoolGeneralModel ) ( model1 ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomain storage = ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue1 ) ) . getReturnValue ( ) ) ) ; poolGeneralModel1.setStorageDomain ( storage.getStorageName ( ) ) ; poolGeneralModel1.getUpdateCompleteEvent ( ) . raise ( this , EventArgs.Empty ) ; }

Target:
public void onSuccess ( java.lang.Object model1 , java.lang.Object ReturnValue1 ) { org.ovirt.engine.ui.uicommonweb.models.pools.PoolGeneralModel poolGeneralModel1 = ( ( org.ovirt.engine.ui.uicommonweb.models.pools.PoolGeneralModel ) ( model1 ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomain storage = ( ( org.ovirt.engine.core.common.businessentities.StorageDomain ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( ReturnValue1 ) ) . getReturnValue ( ) ) ) ; poolGeneralModel1.setStorageDomain ( storage.getStorageName ( ) ) ; poolGeneralModel1.getUpdateCompleteEvent ( ) . raise ( this , EventArgs.Empty ) ; }
Source:
public void setupNetworks ( ) { if ( ( getWindow ( ) ) != null ) { return ; } org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel setupNetworksWindowModel = new org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel ( this , ( ( org.ovirt.engine.core.common.utils.PairQueryable < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface , org.ovirt.engine.core.common.businessentities.VDS > ) ( getSelectedItem ( ) ) ) . getSecond ( ) ) ; setWindow ( setupNetworksWindowModel ) ; }

Target:
public void setupNetworks ( ) { if ( ( getWindow ( ) ) != null ) { return ; } org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel setupNetworksWindowModel = new org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel ( this , getSelectedItem ( ) . getSecond ( ) ) ; setWindow ( setupNetworksWindowModel ) ; }
Source:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE ) ; }

Target:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) , null ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE ) ; }
Source:
private static void addEmptyCD ( org.ovirt.engine.core.compat.Guid dstId ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , dstId ) , VmDeviceGeneralType.DISK , VmDeviceType.CDROM , java.util.Collections.< java.lang.String , java.lang.Object > singletonMap ( VdsProperties.Path , "" ) , true , true ) ; }

Target:
private static void addEmptyCD ( org.ovirt.engine.core.compat.Guid dstId ) { org.ovirt.engine.core.bll.utils.VmDeviceUtils.addManagedDevice ( new org.ovirt.engine.core.common.businessentities.VmDeviceId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , dstId ) , VmDeviceGeneralType.DISK , VmDeviceType.CDROM , java.util.Collections.< java.lang.String , java.lang.Object > singletonMap ( VdsProperties.Path , "" ) , true , true , null ) ; }
Source:
private org.ovirt.engine.core.bll.validator.ImportValidator setupDiskSpaceTest ( org.ovirt.engine.core.common.action.ImportVmParameters parameters ) { org.ovirt.engine.core.bll.validator.ImportValidator validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ImportValidator ( parameters ) ) ; parameters.setCopyCollapse ( true ) ; java.util.ArrayList < org.ovirt.engine.core.compat.Guid > sdIds = new java.util.ArrayList ( java.util.Collections.singletonList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ) ; for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage image : parameters.getVm ( ) . getImages ( ) ) { image.setStorageIds ( sdIds ) ; } org.mockito.Mockito.doReturn ( multipleSdValidator ) . when ( validator ) . createMultipleStorageDomainsValidator ( org.mockito.ArgumentMatchers.anyList ( ) ) ; return validator ; }

Target:
private org.ovirt.engine.core.bll.validator.ImportValidator setupDiskSpaceTest ( org.ovirt.engine.core.common.action.ImportVmParameters parameters ) { org.ovirt.engine.core.bll.validator.ImportValidator validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.validator.ImportValidator ( parameters ) ) ; parameters.setCopyCollapse ( true ) ; java.util.ArrayList < org.ovirt.engine.core.compat.Guid > sdIds = new java.util.ArrayList ( java.util.Collections.singletonList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ) ; for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage image : parameters.getVm ( ) . getImages ( ) ) { image.setStorageIds ( sdIds ) ; } org.mockito.Mockito.doReturn ( multipleSdValidator ) . when ( validator ) . createMultipleStorageDomainsValidator ( org.mockito.ArgumentMatchers.any ( ) ) ; return validator ; }
Source:
public java.lang.Void updateDisk ( final org.ovirt.engine.core.common.businessentities.storage.CinderDisk cinderDisk ) { return execute ( new java.util.concurrent.Callable < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void call ( ) { com.woorea.openstack.cinder.model.VolumeForUpdate volumeForUpdate = new com.woorea.openstack.cinder.model.VolumeForUpdate ( ) ; volumeForUpdate.setName ( cinderDisk.getDiskAlias ( ) ) ; volumeForUpdate.setDescription ( cinderDisk.getDiskDescription ( ) ) ; proxy.updateVolume ( cinderDisk.getImageId ( ) . toString ( ) , volumeForUpdate ) ; return null ; } } ) ; }

Target:
public java.lang.Void updateDisk ( final org.ovirt.engine.core.common.businessentities.storage.CinderDisk cinderDisk ) { return execute ( ( ) -> { com.woorea.openstack.cinder.model.VolumeForUpdate volumeForUpdate = new com.woorea.openstack.cinder.model.VolumeForUpdate ( ) ; volumeForUpdate.setName ( cinderDisk.getDiskAlias ( ) ) ; volumeForUpdate.setDescription ( cinderDisk.getDiskDescription ( ) ) ; proxy.updateVolume ( cinderDisk.getImageId ( ) . toString ( ) , volumeForUpdate ) ; return null ; } ) ; }
Source:
private void updateShareable ( org.ovirt.engine.core.common.businessentities.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { if ( ( storageType.isBlockDomain ( ) ) && ( volumeType == ( org.ovirt.engine.core.common.businessentities.VolumeType.Sparse ) ) ) { getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.shareableDiskNotSupportedByConfiguration ( ) ) ; getIsShareable ( ) . setIsChangable ( false ) ; getIsShareable ( ) . setEntity ( false ) ; } else if ( getIsShareable ( ) . getIsChangable ( ) ) { getIsShareable ( ) . setIsChangable ( isEditEnabled ( ) ) ; } }

Target:
private void updateShareable ( org.ovirt.engine.core.common.businessentities.VolumeType volumeType , org.ovirt.engine.core.common.businessentities.StorageType storageType ) { if ( ( storageType.isBlockDomain ( ) ) && ( volumeType == ( org.ovirt.engine.core.common.businessentities.VolumeType.Sparse ) ) ) { getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.shareableDiskNotSupportedByConfiguration ( ) ) ; getIsShareable ( ) . setIsChangable ( false ) ; getIsShareable ( ) . setEntity ( false ) ; } else { getIsShareable ( ) . setIsChangable ( isEditEnabled ( ) ) ; } }
Source:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" , null ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" , null ) ; storageDevice2.setDevType ( "SDA" ) ; 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.Arrays.asList ( storageDevice1 , storageDevice2 ) ) , null ) ) ; prepareMocks ( cmd , VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" , null ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" , null ) ; storageDevice2.setDevType ( "SDA" ) ; 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.Arrays.asList ( storageDevice1 , storageDevice2 ) ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }
Source:
private void setNonOperational ( org.ovirt.engine.core.common.businessentities.NonOperationalReason reason , java.util.Map < java.lang.String , java.lang.String > customLogValues ) { org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters tempVar = new org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters ( getVds ( ) . getId ( ) , reason , customLogValues ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.SetNonOperationalVds , tempVar , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }

Target:
private void setNonOperational ( org.ovirt.engine.core.common.businessentities.NonOperationalReason reason , java.util.Map < java.lang.String , java.lang.String > customLogValues ) { org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters tempVar = new org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters ( getVds ( ) . getId ( ) , reason , customLogValues ) ; runInternalAction ( VdcActionType.SetNonOperationalVds , tempVar , org.ovirt.engine.core.bll.job.ExecutionHandler.createInternalJobContext ( ) ) ; }
Source:
public static void getRoleActionGroupsByRoleId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid roleId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetRoleActionGroupsByRoleId , new org.ovirt.engine.core.common.queries.MultilevelAdministrationByRoleIdParameters ( roleId ) , aQuery ) ; }

Target:
public static void getRoleActionGroupsByRoleId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid roleId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ActionGroup > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetRoleActionGroupsByRoleId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( roleId ) , aQuery ) ; }
Source:
private java.util.ArrayList < java.lang.String > trimElements ( java.lang.String ... elements ) { java.util.ArrayList < java.lang.String > list = new java.util.ArrayList < > ( elements.length ) ; for ( java.lang.String e : elements ) { e = e.trim ( ) ; if ( ( e.length ( ) ) > 0 ) { list.add ( e ) ; } } return list ; }

Target:
private static java.util.List < java.lang.String > trimElements ( java.lang.String ... elements ) { java.util.List < java.lang.String > list = new java.util.ArrayList < > ( elements.length ) ; for ( java.lang.String e : elements ) { e = e.trim ( ) ; if ( ( e.length ( ) ) > 0 ) { list.add ( e ) ; } } return list ; }
Source:
public void executeCommandWhenFailed ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , false ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE_FAILED ) ; }

Target:
public void executeCommandWhenFailed ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , false ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE_FAILED ) ; }
Source:
public void perform ( ) { try { refreshExistingVmJobList ( ) ; refreshVmStats ( ) ; afterVMsRefreshTreatment ( ) ; vdsManager.vmsMonitoringInitFinished ( ) ; } catch ( java.lang.RuntimeException ex ) { org.ovirt.engine.core.vdsbroker.VmsMonitoring.log.error ( "Failed during vms monitoring on host error is: {}" , vdsManager.getVdsName ( ) , ex ) ; org.ovirt.engine.core.vdsbroker.VmsMonitoring.log.debug ( "Exception:" , ex ) ; } finally { unlockVmsManager ( ) ; } }

Target:
public void perform ( ) { try { refreshExistingVmJobList ( ) ; refreshVmStats ( ) ; afterVMsRefreshTreatment ( ) ; vdsManager.vmsMonitoringInitFinished ( ) ; } catch ( java.lang.RuntimeException ex ) { org.ovirt.engine.core.vdsbroker.VmsMonitoring.log.error ( "Failed during vms monitoring on host error is: {}" , vdsManager.getVdsName ( ) , ex ) ; org.ovirt.engine.core.vdsbroker.VmsMonitoring.log.error ( "Exception:" , ex ) ; } finally { unlockVmsManager ( ) ; } }
Source:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetVmByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.VM_ID } , null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testRemoveNonExistant ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetVmByVmId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { org.ovirt.engine.api.restapi.resource.BackendVmCdromResourceTest.VM_ID } , null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { resource.remove ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertNotNull ( wae.getResponse ( ) ) ; assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }
Source:
protected boolean checkCpuSockets ( ) { return org.ovirt.engine.core.bll.AddVmCommand.CheckCpuSockets ( org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getNumOfSockets ( ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getCpuPerSocket ( ) , org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getcompatibility_version ( ) . toString ( ) , org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getCanDoActionMessages ( ) ) ; }

Target:
protected boolean checkCpuSockets ( ) { return org.ovirt.engine.core.bll.AddVmCommand.checkCpuSockets ( org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getNumOfSockets ( ) , org.ovirt.engine.core.bll.AddVmCommand.getParameters ( ) . getVmStaticData ( ) . getCpuPerSocket ( ) , org.ovirt.engine.core.bll.AddVmCommand.getVdsGroup ( ) . getcompatibility_version ( ) . toString ( ) , org.ovirt.engine.core.bll.AddVmCommand.getReturnValue ( ) . getCanDoActionMessages ( ) ) ; }
Source:
protected java.lang.String getClusterId ( org.ovirt.engine.api.model.VmPool pool ) { return getEntity ( org.ovirt.engine.core.common.businessentities.VDSGroup.class , VdcQueryType.GetVdsGroupByName , new org.ovirt.engine.core.common.queries.NameQueryParameters ( pool.getCluster ( ) . getName ( ) ) , ( "Cluster: name=" + ( pool.getCluster ( ) . getName ( ) ) ) ) . getId ( ) . toString ( ) ; }

Target:
protected org.ovirt.engine.core.common.businessentities.VDSGroup getCluster ( org.ovirt.engine.api.model.VmPool pool ) { return getEntity ( org.ovirt.engine.core.common.businessentities.VDSGroup.class , VdcQueryType.GetVdsGroupByName , new org.ovirt.engine.core.common.queries.NameQueryParameters ( pool.getCluster ( ) . getName ( ) ) , ( "Cluster: name=" + ( pool.getCluster ( ) . getName ( ) ) ) ) ; }
Source:
public org.ovirt.engine.core.common.queries.VdcQueryReturnValue RunQuery ( org.ovirt.engine.core.common.queries.VdcQueryType search , org.ovirt.engine.core.common.queries.VdcQueryParametersBase searchParameters ) { org.ovirt.engine.ui.frontend.server.gwt.GenericApiGWTServiceImpl.log.debug ( "Server: RunQuery invoked!" ) ; debugQuery ( search , searchParameters ) ; searchParameters.setSessionId ( getSessionId ( ) ) ; return getBackend ( ) . RunQuery ( search , searchParameters ) ; }

Target:
public org.ovirt.engine.core.common.queries.VdcQueryReturnValue RunQuery ( org.ovirt.engine.core.common.queries.VdcQueryType search , org.ovirt.engine.core.common.queries.VdcQueryParametersBase searchParameters ) { org.ovirt.engine.ui.frontend.server.gwt.GenericApiGWTServiceImpl.log.debug ( "Server: RunQuery invoked!" ) ; debugQuery ( search , searchParameters ) ; searchParameters.setSessionId ( getSessionId ( ) ) ; return getBackend ( ) . runQuery ( search , searchParameters ) ; }
Source:
public void testGet ( ) throws java.lang.Exception { org.ovirt.engine.api.restapi.resource.BackendFileResource resource = new org.ovirt.engine.api.restapi.resource.BackendFileResource ( NAMES [ 0 ] . toString ( ) , collection ) ; collection.setUriInfo ( setUpUriExpectations ( null ) ) ; setUpQueryExpectations ( "" , null ) ; verifyModel ( resource.get ( ) , 0 ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { org.ovirt.engine.api.restapi.resource.BackendFileResource resource = new org.ovirt.engine.api.restapi.resource.BackendFileResource ( NAMES [ 0 ] , collection ) ; collection.setUriInfo ( setUpUriExpectations ( null ) ) ; setUpQueryExpectations ( "" , null ) ; verifyModel ( resource.get ( ) , 0 ) ; }
Source:
public void testInitQueryParams ( ) { java.lang.String sessionId = "sessionId" ; testServlet.initQueryParams ( mockQueryParams , sessionId ) ; org.mockito.Mockito.verify ( mockQueryParams ) . setSessionId ( sessionId ) ; org.mockito.Mockito.verify ( mockQueryParams ) . setHttpSessionId ( sessionId ) ; org.mockito.Mockito.verify ( mockQueryParams ) . setFiltered ( testServlet.filterQueries ( ) ) ; }

Target:
public void testInitQueryParams ( ) { java.lang.String sessionId = "sessionId" ; testServlet.initQueryParams ( mockQueryParams , sessionId ) ; org.mockito.Mockito.verify ( mockQueryParams ) . setSessionId ( sessionId ) ; org.mockito.Mockito.verify ( mockQueryParams ) . setFiltered ( testServlet.filterQueries ( ) ) ; }
Source:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; control.replay ( ) ; org.ovirt.engine.api.model.OpenStackNetworkProvider model = getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }

Target:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 ) ; org.ovirt.engine.api.model.OpenStackNetworkProvider model = getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }
Source:
private static void addBootProtocol ( java.util.Map < java.lang.String , java.lang.Object > entry , org.ovirt.engine.core.common.businessentities.VDS host , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface ) { org.ovirt.engine.core.vdsbroker.vdsbroker.BootProtocolResolver resolver = ( org.ovirt.engine.core.common.FeatureSupported.cfgEntriesDeprecated ( host.getClusterCompatibilityVersion ( ) ) ) ? new org.ovirt.engine.core.vdsbroker.vdsbroker.NoCfgBootProtocolResolver ( entry , iface , host ) : new org.ovirt.engine.core.vdsbroker.vdsbroker.CfgBootProtocolResolver ( entry , iface , host ) ; resolver.resolve ( ) ; }

Target:
private static void addBootProtocol ( java.util.Map < java.lang.String , java.lang.Object > entry , org.ovirt.engine.core.common.businessentities.VDS host , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface ) { org.ovirt.engine.core.vdsbroker.vdsbroker.BootProtocolResolver resolver = ( org.ovirt.engine.core.common.FeatureSupported.cfgEntriesDeprecated ( host.getClusterCompatibilityVersion ( ) ) ) ? new org.ovirt.engine.core.vdsbroker.vdsbroker.NoCfgBootProtocolResolver ( entry , iface ) : new org.ovirt.engine.core.vdsbroker.vdsbroker.CfgBootProtocolResolver ( entry , iface ) ; resolver.resolve ( ) ; }
Source:
protected void endWithFailure ( ) { super . endActionOnDisks ( ) ; rollbackQuota ( ) ; if ( ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) ) != null ) { removeVmInSpm ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) . getstorage_pool_id ( ) , org.ovirt.engine.core.bll.AddVmCommand.getVmId ( ) ) ; } removeVmRelatedEntitiesFromDb ( ) ; org.ovirt.engine.core.bll.AddVmCommand.setSucceeded ( true ) ; }

Target:
protected void endWithFailure ( ) { super . endActionOnDisks ( ) ; if ( ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) ) != null ) { removeVmInSpm ( org.ovirt.engine.core.bll.AddVmCommand.getVm ( ) . getstorage_pool_id ( ) , org.ovirt.engine.core.bll.AddVmCommand.getVmId ( ) ) ; } removeVmRelatedEntitiesFromDb ( ) ; org.ovirt.engine.core.bll.AddVmCommand.setSucceeded ( true ) ; }
Source:
public void testListIncludeStatistics ( ) throws java.lang.Exception { try { accepts.add ( "application/xml; detail=statistics" ) ; javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpGetCertificateInfo ( NAMES.length ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.Host > hosts = getCollection ( ) ; assertTrue ( hosts.get ( 0 ) . isSetStatistics ( ) ) ; verifyCollection ( hosts ) ; } finally { accepts.clear ( ) ; } }

Target:
public void testListIncludeStatistics ( ) throws java.lang.Exception { try { accepts.add ( "application/xml; detail=statistics" ) ; javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.Host > hosts = getCollection ( ) ; assertTrue ( hosts.get ( 0 ) . isSetStatistics ( ) ) ; verifyCollection ( hosts ) ; } finally { accepts.clear ( ) ; } }
Source:
public static void GetNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.GetAllNetworkQueryParamenters ( dataCenterId ) , aQuery ) ; }

Target:
public static void GetNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ) ( source ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllNetworks , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) , aQuery ) ; }
Source:
public static void getGlusterHookContent ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid hookId , 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 : "" ; } } ; org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters parameters = new org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters ( hookId ) ; parameters.setGlusterServerId ( serverId ) ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetGlusterHookContent , parameters , aQuery ) ; }

Target:
public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; }
Source:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getSucceeded ( ) ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_DISABLE ) ; }

Target:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getSucceeded ( ) ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_DISABLE ) ; }
Source:
private static boolean isDiskProfilePermitted ( org.ovirt.engine.core.common.businessentities.profiles.DiskProfile diskProfile , java.util.Set < org.ovirt.engine.core.compat.Guid > permittedDiskProfilesIds , org.ovirt.engine.core.common.businessentities.aaa.DbUser user ) { return ( permittedDiskProfilesIds.contains ( diskProfile.getId ( ) ) ) || ( ( org.ovirt.engine.core.bll.profiles.DiskProfileHelper.getPermissionDAO ( ) . getEntityPermissions ( user.getId ( ) , ActionGroup.ATTACH_DISK_PROFILE , diskProfile.getId ( ) , VdcObjectType.DiskProfile ) ) != null ) ; }

Target:
private static boolean isDiskProfilePermitted ( org.ovirt.engine.core.common.businessentities.profiles.DiskProfile diskProfile , java.util.Set < org.ovirt.engine.core.compat.Guid > permittedDiskProfilesIds , org.ovirt.engine.core.common.businessentities.aaa.DbUser user ) { return ( ( user == null ) || ( permittedDiskProfilesIds.contains ( diskProfile.getId ( ) ) ) ) || ( ( org.ovirt.engine.core.bll.profiles.DiskProfileHelper.getPermissionDAO ( ) . getEntityPermissions ( user.getId ( ) , ActionGroup.ATTACH_DISK_PROFILE , diskProfile.getId ( ) , VdcObjectType.DiskProfile ) ) != null ) ; }
Source:
public org.ovirt.engine.ui.uicommonweb.validation.ValidationResult validate ( java.lang.Object value ) { org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ipValidation = org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.IP_VALIDATOR.validate ( value ) ; if ( ! ( ipValidation.getSuccess ( ) ) ) { return ipValidation ; } org.ovirt.engine.ui.uicommonweb.validation.ValidationResult result = new org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ( ) ; if ( ( value != null ) && ( value instanceof java.lang.String ) ) { result.setSuccess ( validateNetMask ( ( ( java.lang.String ) ( value ) ) ) ) ; result.setReasons ( org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.reasons ) ; } return result ; }

Target:
public org.ovirt.engine.ui.uicommonweb.validation.ValidationResult validate ( java.lang.Object value ) { org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ipValidation = org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.IP_VALIDATOR.validate ( value ) ; if ( ! ( ipValidation.getSuccess ( ) ) ) { return ipValidation ; } org.ovirt.engine.ui.uicommonweb.validation.ValidationResult result = new org.ovirt.engine.ui.uicommonweb.validation.ValidationResult ( ) ; if ( value instanceof java.lang.String ) { result.setSuccess ( validateNetMask ( ( ( java.lang.String ) ( value ) ) ) ) ; result.setReasons ( org.ovirt.engine.ui.uicommonweb.validation.SubnetMaskValidation.reasons ) ; } return result ; }
Source:
public static org.ovirt.engine.core.compat.NGuid generateHookId ( java.lang.String eventName , java.lang.String hookName , java.lang.String md5 ) { java.lang.String idString = ( eventName + hookName ) + md5 ; try { byte [ ] hash = java.security.MessageDigest.getInstance ( org.ovirt.engine.api.restapi.types.HostMapper.MD5_SECURITY_ALGORITHM ) . digest ( idString.getBytes ( ) ) ; org.ovirt.engine.core.compat.NGuid guid = new org.ovirt.engine.core.compat.NGuid ( hash , true ) ; return guid ; } catch ( java.security.NoSuchAlgorithmException e ) { throw new java.lang.IllegalStateException ( e ) ; } }

Target:
public static org.ovirt.engine.core.compat.Guid generateHookId ( java.lang.String eventName , java.lang.String hookName , java.lang.String md5 ) { java.lang.String idString = ( eventName + hookName ) + md5 ; try { byte [ ] hash = java.security.MessageDigest.getInstance ( org.ovirt.engine.api.restapi.types.HostMapper.MD5_SECURITY_ALGORITHM ) . digest ( idString.getBytes ( ) ) ; org.ovirt.engine.core.compat.Guid guid = new org.ovirt.engine.core.compat.Guid ( hash , true ) ; return guid ; } catch ( java.security.NoSuchAlgorithmException e ) { throw new java.lang.IllegalStateException ( e ) ; } }
Source:
public static org.ovirt.engine.core.common.businessentities.DbUser persistAuthenticatedUser ( org.ovirt.engine.core.aaa.DirectoryUser directoryUser ) { org.ovirt.engine.core.dao.DbUserDAO dao = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDbUserDao ( ) ; org.ovirt.engine.core.common.businessentities.DbUser dbUser = dao.getByExternalId ( directoryUser.getDirectoryName ( ) , directoryUser.getId ( ) ) ; if ( dbUser != null ) { dao.update ( dbUser ) ; } else { dbUser = new org.ovirt.engine.core.common.businessentities.DbUser ( directoryUser ) ; dbUser.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; dao.save ( dbUser ) ; } return dbUser ; }

Target:
public static org.ovirt.engine.core.common.businessentities.DbUser persistAuthenticatedUser ( org.ovirt.engine.core.aaa.DirectoryUser directoryUser ) { org.ovirt.engine.core.dao.DbUserDAO dao = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDbUserDao ( ) ; org.ovirt.engine.core.common.businessentities.DbUser dbUser = dao.getByExternalId ( directoryUser.getDirectoryName ( ) , directoryUser.getId ( ) ) ; if ( dbUser != null ) { dao.update ( dbUser ) ; } else { dbUser = new org.ovirt.engine.core.common.businessentities.DbUser ( directoryUser ) ; dao.save ( dbUser ) ; } return dbUser ; }
Source:
public void setup ( ) { storagePool = new org.ovirt.engine.core.common.businessentities.storage_pool ( "test" , org.ovirt.engine.core.compat.Guid.NewGuid ( ) , "test" , StorageType.UNKNOWN.getValue ( ) , StoragePoolStatus.Up.getValue ( ) ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.StoragePoolValidator ( storagePool , new java.util.ArrayList < java.lang.String > ( ) ) ) ; mockPosixStorageEnabledConfigValue ( ) ; }

Target:
public void setup ( ) { storagePool = new org.ovirt.engine.core.common.businessentities.storage_pool ( "test" , org.ovirt.engine.core.compat.Guid.NewGuid ( ) , "test" , StorageType.UNKNOWN.getValue ( ) , StoragePoolStatus.Up.getValue ( ) ) ; validator = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.StoragePoolValidator ( storagePool , new java.util.ArrayList < java.lang.String > ( ) ) ) ; }
Source:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.storage.MoveOrCopyDiskModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.MoveOrCopyDiskModel ) ( target ) ) ; org.ovirt.engine.core.common.businessentities.storage_pool dataCenter = ( ( org.ovirt.engine.core.common.businessentities.storage_pool ) ( returnValue ) ) ; model.setQuotaEnforcementType ( dataCenter.getQuotaEnforcementType ( ) ) ; model.postInitStorageDomains ( ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.storage.MoveOrCopyDiskModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.MoveOrCopyDiskModel ) ( target ) ) ; org.ovirt.engine.core.common.businessentities.StoragePool dataCenter = ( ( org.ovirt.engine.core.common.businessentities.StoragePool ) ( returnValue ) ) ; model.setQuotaEnforcementType ( dataCenter.getQuotaEnforcementType ( ) ) ; model.postInitStorageDomains ( ) ; }
Source:
private boolean isDiskLun ( ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = org.ovirt.engine.core.bll.CopyImageGroupCommand.getDiskDao ( ) . get ( org.ovirt.engine.core.bll.CopyImageGroupCommand.getParameters ( ) . getImageGroupID ( ) ) ; return ! ( validate ( new org.ovirt.engine.core.bll.validator.storage.DiskValidator ( disk ) . validateDiskIsNotLun ( ) ) ) ; }

Target:
private boolean isDiskLun ( ) { org.ovirt.engine.core.common.businessentities.storage.Disk disk = org.ovirt.engine.core.bll.CopyImageGroupCommand.getDiskDao ( ) . get ( org.ovirt.engine.core.bll.CopyImageGroupCommand.getParameters ( ) . getImageGroupID ( ) ) ; if ( disk != null ) { return ! ( validate ( new org.ovirt.engine.core.bll.validator.storage.DiskValidator ( disk ) . validateDiskIsNotLun ( ) ) ) ; } return false ; }