auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public java.lang.String getValue ( org.ovirt.engine.core.common.businessentities.DiskImage object ) { return new org.ovirt.engine.ui.common.widget.renderer.EnumRenderer < org.ovirt.engine.core.common.businessentities.VolumeType > ( ) . render ( org.ovirt.engine.core.common.businessentities.VolumeType.forValue ( object.getvolume_type ( ) . getValue ( ) ) ) ; }

Target:
public java.lang.String getValue ( org.ovirt.engine.core.common.businessentities.DiskImage disk ) { org.ovirt.engine.ui.uicommonweb.models.vms.ImportData importData = object.getDiskImportData ( disk.getId ( ) ) ; if ( importData == null ) { return "" ; } return new org.ovirt.engine.ui.common.widget.renderer.EnumRenderer < org.ovirt.engine.core.common.businessentities.VolumeType > ( ) . render ( org.ovirt.engine.core.common.businessentities.VolumeType.forValue ( importData.getSelectedVolumeType ( ) . getValue ( ) ) ) ; }
Source:
protected void executeCommand ( ) { java.lang.Integer ovfStoresCountForDomain = org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.StorageDomainOvfStoreCount ) ; for ( int i = ovfDiskCount ; i < ovfStoresCountForDomain ; i ++ ) { org.ovirt.engine.core.bll.Backend.getInstance ( ) . runInternalAction ( VdcActionType.CreateOvfVolumeForStorageDomain , new org.ovirt.engine.core.common.action.StorageDomainParametersBase ( org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.getParameters ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.getParameters ( ) . getStorageDomainId ( ) ) ) ; } updateOvfStoreContent ( ) ; org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.setSucceeded ( true ) ; }

Target:
protected void executeCommand ( ) { updateOvfStoreContent ( ) ; int missingDiskCount = ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.StorageDomainOvfStoreCount ) ) - ( ovfDiskCount ) ; if ( missingDiskCount > 0 ) { org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.getBackend ( ) . runInternalAction ( VdcActionType.CreateOvfStoresForStorageDomain , new org.ovirt.engine.core.common.action.CreateOvfStoresForStorageDomainCommandParameters ( org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.getParameters ( ) . getStoragePoolId ( ) , org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.getParameters ( ) . getStorageDomainId ( ) , missingDiskCount ) ) ; } org.ovirt.engine.core.bll.ProcessOvfUpdateForStorageDomainCommand.setSucceeded ( true ) ; }
Source:
public java.lang.Void runInTransaction ( ) { getCompensationContext ( ) . snapshotEntity ( masterDomain.getStorageStaticData ( ) ) ; masterDomain.setstorage_domain_type ( StorageDomainType.Data ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainStaticDAO ( ) . update ( masterDomain.getStorageStaticData ( ) ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { getCompensationContext ( ) . snapshotEntity ( masterDomain.getStorageStaticData ( ) ) ; masterDomain.setstorage_domain_type ( StorageDomainType.Data ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getStorageDomainStaticDao ( ) . update ( masterDomain.getStorageStaticData ( ) ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; }
Source:
public boolean match ( org.ovirt.engine.core.common.businessentities.network.VnicProfileView vnicProfile ) { return ( java.util.Objects.equals ( getEntity ( ) . getExternalNetworkName ( ) , vnicProfile.getNetworkName ( ) ) ) && ( java.util.Objects.equals ( getEntity ( ) . getExternalNetworkName ( ) , vnicProfile.getName ( ) ) ) ; }

Target:
public boolean match ( org.ovirt.engine.core.common.businessentities.network.VnicProfileView vnicProfile ) { return java.util.Objects.equals ( getEntity ( ) . getVnicProfileId ( ) , vnicProfile.getId ( ) ) ; }
Source:
public void testUpdateStorageDomainExternalStatus ( ) { existingEntity.setExternalStatus ( ExternalStatus.Error ) ; dao.updateExternalStatus ( getExistingEntityId ( ) , existingEntity.getExternalStatus ( ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomainDynamic after = dao.get ( existingEntity.getId ( ) ) ; org.junit.Assert.assertEquals ( existingEntity.getExternalStatus ( ) , after.getExternalStatus ( ) ) ; }

Target:
public void testUpdateStorageDomainExternalStatus ( ) { existingEntity.setExternalStatus ( ExternalStatus.Error ) ; dao.updateExternalStatus ( getExistingEntityId ( ) , existingEntity.getExternalStatus ( ) ) ; org.ovirt.engine.core.common.businessentities.StorageDomainDynamic after = dao.get ( existingEntity.getId ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( existingEntity.getExternalStatus ( ) , after.getExternalStatus ( ) ) ; }
Source:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Permission permission ) { validateParameters ( permission , ( isPrincipalSubCollection ( ) ? new java.lang.String [ ] { "role.id" , "dataCenter|cluster|host|storageDomain|vm|vmpool|template.id" } : new java.lang.String [ ] { "role.id" , "user|group.id" } ) ) ; org.ovirt.engine.core.common.action.PermissionsOperationsParameters parameters = getParameters ( permission ) ; org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; return performCreate ( VdcActionType.AddPermission , parameters , resolver ) ; }

Target:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Permission permission ) { validateParameters ( permission , ( isPrincipalSubCollection ( ) ? new java.lang.String [ ] { "role.id|name" , "dataCenter|cluster|host|storageDomain|vm|vmpool|template.id" } : new java.lang.String [ ] { "role.id|name" , "user|group.id" } ) ) ; org.ovirt.engine.core.common.action.PermissionsOperationsParameters parameters = getParameters ( permission ) ; org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > resolver = new org.ovirt.engine.api.restapi.resource.QueryIdResolver ( org.ovirt.engine.core.common.queries.VdcQueryType.GetPermissionById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ; return performCreate ( VdcActionType.AddPermission , parameters , resolver ) ; }
Source:
public java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > getCachedIsoListByPoolAndDomainId ( org.ovirt.engine.core.compat.Guid isoStoragePoolId , org.ovirt.engine.core.compat.Guid isoStorageDomainId ) { java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > fileListMD = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > ( ) ; if ( ( isoStorageDomainId != null ) && ( isoStoragePoolId != null ) ) { fileListMD = repoStorageDom.getRepoListForStorageDomainAndStoragePool ( isoStoragePoolId , isoStorageDomainId , FileTypeExtension.ISO ) ; } return fileListMD ; }

Target:
public java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > getCachedIsoListByStoragePoolAndDomainId ( org.ovirt.engine.core.compat.Guid isoStoragePoolId , org.ovirt.engine.core.compat.Guid isoStorageDomainId ) { java.util.List < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > fileListMD = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.RepoFileMetaData > ( ) ; if ( ( ( isoStorageDomainId != null ) && ( isoStoragePoolId != null ) ) && ( ( org.ovirt.engine.core.bll.VmRunHandler.getInstance ( ) . findActiveISODomain ( isoStoragePoolId ) ) != null ) ) { fileListMD = repoStorageDom.getRepoListForStorageDomainAndStoragePool ( isoStoragePoolId , isoStorageDomainId , FileTypeExtension.ISO ) ; } return fileListMD ; }
Source:
private void hotSetMemory ( int newAmountOfMemory ) { int currentMemory = org.ovirt.engine.core.bll.UpdateVmCommand.getVm ( ) . getMemSizeMb ( ) ; org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters params = new org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters ( newVmStatic , ( currentMemory < newAmountOfMemory ? org.ovirt.engine.core.common.action.PlugAction.PLUG : org.ovirt.engine.core.common.action.PlugAction.UNPLUG ) , 0 ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase setAmountOfMemoryResult = runInternalAction ( VdcActionType.HotSetAmountOfMemory , params , org.ovirt.engine.core.bll.UpdateVmCommand.cloneContextAndDetachFromParent ( ) ) ; newVmStatic.setMemSizeMb ( ( setAmountOfMemoryResult.getSucceeded ( ) ? newAmountOfMemory : currentMemory ) ) ; auditLogHotSetMemCandos ( params , setAmountOfMemoryResult ) ; }

Target:
private void hotSetMemory ( int newAmountOfMemory ) { int currentMemory = org.ovirt.engine.core.bll.UpdateVmCommand.getVm ( ) . getMemSizeMb ( ) ; org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters params = new org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters ( newVmStatic , ( currentMemory < newAmountOfMemory ? org.ovirt.engine.core.common.action.PlugAction.PLUG : org.ovirt.engine.core.common.action.PlugAction.UNPLUG ) , 0 ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase setAmountOfMemoryResult = runInternalAction ( VdcActionType.HotSetAmountOfMemory , params , org.ovirt.engine.core.bll.UpdateVmCommand.cloneContextAndDetachFromParent ( ) ) ; if ( ! ( org.ovirt.engine.core.bll.UpdateVmCommand.getVm ( ) . isHostedEngine ( ) ) ) { newVmStatic.setMemSizeMb ( ( setAmountOfMemoryResult.getSucceeded ( ) ? newAmountOfMemory : currentMemory ) ) ; } auditLogHotSetMemCandos ( params , setAmountOfMemoryResult ) ; }
Source:
public void clusterNotChanged ( ) { org.ovirt.engine.core.compat.Guid clusterId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.mockito.Mockito.when ( oldHost.getVdsGroupId ( ) ) . thenReturn ( clusterId ) ; org.mockito.Mockito.when ( host.getVdsGroupId ( ) ) . thenReturn ( clusterId ) ; org.junit.Assert.assertThat ( validator.clusterNotChanged ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void clusterChanged ( ) { org.mockito.Mockito.when ( oldHost.getClusterId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.mockito.Mockito.when ( host.getClusterId ( ) ) . thenReturn ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.junit.Assert.assertThat ( validator.clusterNotChanged ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.VDS_CANNOT_UPDATE_CLUSTER ) ) ; }
Source:
public void vdsGroupWithVirtGlusterServicesNotAllowed ( ) { createCommandWithVirtGlusterEnabled ( ) ; org.mockito.Mockito.when ( vdsGroupDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.createVdsGroupWithNoCpuName ( ) ) ; org.mockito.Mockito.when ( vdsGroupDAO.getByName ( org.mockito.Matchers.anyString ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.createVdsGroupWithNoCpuName ( ) ) ; org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.mcr.mockConfigValue ( ConfigValues.AllowClusterWithVirtGlusterEnabled , java.lang.Boolean.FALSE ) ; cpuExists ( ) ; allQueriesEmpty ( ) ; canDoActionFailedWithReason ( VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED ) ; }

Target:
public void vdsGroupWithVirtGlusterServicesNotAllowed ( ) { createCommandWithVirtGlusterEnabled ( ) ; org.mockito.Mockito.when ( vdsGroupDAO.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.createVdsGroupWithNoCpuName ( ) ) ; org.mockito.Mockito.when ( vdsGroupDAO.getByName ( org.mockito.Matchers.anyString ( ) ) ) . thenReturn ( org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.createVdsGroupWithNoCpuName ( ) ) ; org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.mcr.mockConfigValue ( ConfigValues.AllowClusterWithVirtGlusterEnabled , java.lang.Boolean.FALSE ) ; cpuExists ( ) ; allQueriesForVms ( ) ; canDoActionFailedWithReason ( VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED ) ; }
Source:
private static void constructGroupsMembershipTree ( org.ovirt.engine.api.extensions.ExtMap entity , org.ovirt.engine.api.extensions.ExtKey key , java.util.Map < java.lang.String , org.ovirt.engine.api.extensions.ExtMap > groupsCache ) { java.util.List < org.ovirt.engine.api.extensions.ExtMap > groups = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.api.extensions.ExtMap memberOf : entity.get ( key , java.util.Collections.< org.ovirt.engine.api.extensions.ExtMap > emptyList ( ) ) ) { org.ovirt.engine.core.aaa.AuthzUtils.constructGroupsMembershipTree ( memberOf , GroupRecord.GROUPS , groupsCache ) ; groups.add ( groupsCache.get ( memberOf.get ( GroupRecord.ID ) ) ) ; } entity.put ( key , groups ) ; }

Target:
private static void constructGroupsMembershipTree ( org.ovirt.engine.api.extensions.ExtMap entity , org.ovirt.engine.api.extensions.ExtKey key , java.util.Map < java.lang.String , org.ovirt.engine.api.extensions.ExtMap > groupsCache ) { java.util.List < org.ovirt.engine.api.extensions.ExtMap > groups = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.api.extensions.ExtMap memberOf : entity.get ( key , java.util.Collections.< org.ovirt.engine.api.extensions.ExtMap > emptyList ( ) ) ) { org.ovirt.engine.api.extensions.ExtMap cachedGroup = groupsCache.get ( memberOf.get ( GroupRecord.ID ) ) ; org.ovirt.engine.core.aaa.AuthzUtils.constructGroupsMembershipTree ( cachedGroup , GroupRecord.GROUPS , groupsCache ) ; groups.add ( cachedGroup ) ; } entity.put ( key , groups ) ; }
Source:
public void testAttachFailDomainAlreadyInPool ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap > isoMap = new java.util.ArrayList < > ( ) ; isoMap.add ( new org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap ( ) ) ; org.mockito.Mockito.when ( storagePoolIsoMapDao.getAllForStorage ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( isoMap ) ; org.ovirt.engine.core.bll.ValidationResult attachedDomainInsertionResult = validator.validateDomainCanBeAttachedToPool ( ) ; org.junit.Assert.assertFalse ( "Attaching domain that is already in a pool succeeded while it should have failed" , attachedDomainInsertionResult.isValid ( ) ) ; assertFailingMessage ( "Attaching domain that is already in a pool failed with the wrong message" , attachedDomainInsertionResult , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL ) ; }

Target:
public void testAttachFailDomainAlreadyInPool ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap > isoMap = new java.util.ArrayList < > ( ) ; isoMap.add ( new org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap ( ) ) ; org.mockito.Mockito.when ( storagePoolIsoMapDao.getAllForStorage ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( isoMap ) ; org.ovirt.engine.core.bll.ValidationResult attachedDomainInsertionResult = validator.validateDomainCanBeAttachedToPool ( ) ; org.junit.Assert.assertFalse ( "Attaching domain that is already in a pool succeeded while it should have failed" , attachedDomainInsertionResult.isValid ( ) ) ; assertFailingMessage ( "Attaching domain that is already in a pool failed with the wrong message" , attachedDomainInsertionResult , EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL ) ; }
Source:
private void updateVmsOfInstanceType ( ) { if ( ! ( isInstanceType ( ) ) ) { return ; } java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmsToUpdate = vmDao.getVmsListByInstanceType ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVmTemplateId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vmsToUpdate ) { org.ovirt.engine.core.common.action.VmManagementParametersBase params = new org.ovirt.engine.core.common.action.VmManagementParametersBase ( vm ) ; params.setApplyChangesLater ( true ) ; runInternalAction ( VdcActionType.UpdateVm , params ) ; } }

Target:
private void updateVmsOfInstanceType ( ) { if ( ! ( isInstanceType ( ) ) ) { return ; } java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmsToUpdate = vmDao.getVmsListByInstanceType ( org.ovirt.engine.core.bll.UpdateVmTemplateCommand.getVmTemplateId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VM vm : vmsToUpdate ) { org.ovirt.engine.core.common.action.VmManagementParametersBase params = new org.ovirt.engine.core.common.action.VmManagementParametersBase ( vm ) ; params.setApplyChangesLater ( true ) ; runInternalAction ( ActionType.UpdateVm , params ) ; } }
Source:
public void Cluster_SelectedItemChanged ( ) { UpdateDefaultHost ( ) ; UpdateCustomProperties ( ) ; UpdateMinAllocatedMemory ( ) ; UpdateNumOfSockets ( ) ; if ( ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) ) != null ) { updateQuotaByCluster ( ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) ) . getQuotaId ( ) ) ; } }

Target:
public void Cluster_SelectedItemChanged ( ) { UpdateDefaultHost ( ) ; UpdateCustomProperties ( ) ; UpdateMinAllocatedMemory ( ) ; UpdateNumOfSockets ( ) ; if ( ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) ) != null ) { org.ovirt.engine.core.common.businessentities.VmTemplate template = ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( getModel ( ) . getTemplate ( ) . getSelectedItem ( ) ) ) ; updateQuotaByCluster ( template.getQuotaId ( ) , template.getQuotaName ( ) ) ; } }
Source:
public static void GetExternalNetworkList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid providerId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.Network > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAllExternalNetworksOnProvider , new org.ovirt.engine.core.common.queries.IdQueryParameters ( providerId ) , aQuery ) ; }

Target:
public static void getVmGuestAgentInterfacesByVmId ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source == null ) { return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVmGuestAgentInterfacesByVmId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) , aQuery ) ; }
Source:
private void undo ( ) { org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( getEntity ( ) ) ) ; if ( vm != null ) { org.ovirt.engine.core.common.businessentities.Snapshot snapshot = getPreview ( ) ; org.ovirt.engine.ui.frontend.Frontend.RunAction ( VdcActionType.RestoreAllSnapshots , new org.ovirt.engine.core.common.action.RestoreAllSnapshotsParameters ( vm.getId ( ) , snapshot.getId ( ) ) , null , null ) ; } }

Target:
private void undo ( ) { org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( getEntity ( ) ) ) ; if ( vm != null ) { org.ovirt.engine.core.common.businessentities.Snapshot snapshot = getPreview ( ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runAction ( VdcActionType.RestoreAllSnapshots , new org.ovirt.engine.core.common.action.RestoreAllSnapshotsParameters ( vm.getId ( ) , org.ovirt.engine.core.common.businessentities.SnapshotActionEnum.UNDO ) , null , null ) ; } }
Source:
protected void prepareRoleForCommand ( ) { org.ovirt.engine.core.common.businessentities.Role role = org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getRole ( ) ; role.setId ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ; role.setAllowsViewingChildren ( false ) ; for ( org.ovirt.engine.core.common.businessentities.ActionGroup group : org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getParameters ( ) . getActionGroups ( ) ) { if ( group.allowsViewingChildren ( ) ) { role.setAllowsViewingChildren ( true ) ; break ; } } }

Target:
protected void prepareRoleForCommand ( ) { org.ovirt.engine.core.common.businessentities.Role role = org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getRole ( ) ; role.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; role.setAllowsViewingChildren ( false ) ; for ( org.ovirt.engine.core.common.businessentities.ActionGroup group : org.ovirt.engine.core.bll.AddRoleWithActionGroupsCommand.getParameters ( ) . getActionGroups ( ) ) { if ( group.allowsViewingChildren ( ) ) { role.setAllowsViewingChildren ( true ) ; break ; } } }
Source:
private static void runActionExecutionFailed ( org.ovirt.engine.core.common.action.VdcActionType actionType , org.ovirt.engine.core.common.errors.VdcFault fault ) { if ( ( org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) ) != null ) { java.lang.String translatedMessage = org.ovirt.engine.ui.frontend.Frontend.vdsmErrorsTranslator.TranslateErrorTextSingle ( ( ( fault.getError ( ) ) == null ? fault.getMessage ( ) : fault.getError ( ) . toString ( ) ) ) ; fault.setMessage ( translatedMessage ) ; org.ovirt.engine.ui.frontend.Frontend.getEventsHandler ( ) . runActionExecutionFailed ( actionType , fault ) ; } }

Target:
public static java.lang.String translateVdcFault ( org.ovirt.engine.core.common.errors.VdcFault fault ) { return org.ovirt.engine.ui.frontend.Frontend.vdsmErrorsTranslator.TranslateErrorTextSingle ( ( ( fault.getError ( ) ) == null ? fault.getMessage ( ) : fault.getError ( ) . toString ( ) ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object result ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ExternalComputeResource > computeResources = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ExternalComputeResource > ) ( result ) ) ; org.ovirt.engine.ui.uicommonweb.models.ListModel externalComputeResourceListModel = getExternalComputeResource ( ) ; externalComputeResourceListModel.setItems ( computeResources ) ; externalComputeResourceListModel.setIsChangable ( true ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object result ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ExternalComputeResource > computeResources = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.ExternalComputeResource > ) ( result ) ) ; org.ovirt.engine.ui.uicommonweb.models.ListModel externalComputeResourceListModel = getExternalComputeResource ( ) ; externalComputeResourceListModel.setItems ( computeResources ) ; externalComputeResourceListModel.setIsChangeable ( true ) ; }
Source:
private static org.ovirt.engine.core.common.businessentities.DiskImage getDiskImageById ( org.ovirt.engine.core.compat.Guid id , java.lang.Iterable < org.ovirt.engine.core.common.businessentities.DiskImage > diskImages ) { for ( org.ovirt.engine.core.common.businessentities.DiskImage diskImage : diskImages ) { if ( diskImage.getId ( ) . equals ( id ) ) { return diskImage ; } } return null ; }

Target:
private static org.ovirt.engine.core.common.businessentities.storage.DiskImage getDiskImageById ( org.ovirt.engine.core.compat.Guid id , java.lang.Iterable < org.ovirt.engine.core.common.businessentities.storage.DiskImage > diskImages ) { for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage diskImage : diskImages ) { if ( diskImage.getId ( ) . equals ( id ) ) { return diskImage ; } } return null ; }
Source:
public static void GetDataCenterById ( 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 ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetStoragePoolById , new org.ovirt.engine.core.common.queries.StoragePoolQueryParametersBase ( dataCenterId ) , aQuery ) ; }

Target:
public static void getGlusterHostsNewlyAdded ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid clusterId , boolean isFingerprintRequired ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetAddedGlusterServers , new org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters ( clusterId , isFingerprintRequired ) , aQuery ) ; }
Source:
private void removeMemoryVolumes ( ) { java.util.Set < java.lang.String > memoryStates = org.ovirt.engine.core.bll.memory.MemoryUtils.getMemoryVolumesFromSnapshots ( org.ovirt.engine.core.bll.RemoveVmCommand.getDbFacade ( ) . getSnapshotDao ( ) . getAll ( org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) ) ) ; for ( java.lang.String memoryState : memoryStates ) { org.ovirt.engine.core.common.action.VdcReturnValueBase retVal = runInternalAction ( VdcActionType.RemoveMemoryVolumes , buildRemoveMemoryVolumesParameters ( memoryState , org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) ) , org.ovirt.engine.core.bll.RemoveVmCommand.cloneContextAndDetachFromParent ( ) ) ; if ( ! ( retVal.getSucceeded ( ) ) ) { log.errorFormat ( "Failed to remove memory volumes whie removing vm {0} (volumes: {1})" , org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) , memoryState ) ; } } }

Target:
private void removeMemoryVolumes ( ) { java.util.Set < java.lang.String > memoryStates = org.ovirt.engine.core.bll.memory.MemoryUtils.getMemoryVolumesFromSnapshots ( org.ovirt.engine.core.bll.RemoveVmCommand.getDbFacade ( ) . getSnapshotDao ( ) . getAll ( org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) ) ) ; for ( java.lang.String memoryState : memoryStates ) { org.ovirt.engine.core.common.action.VdcReturnValueBase retVal = runInternalAction ( VdcActionType.RemoveMemoryVolumes , buildRemoveMemoryVolumesParameters ( memoryState , org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) ) , org.ovirt.engine.core.bll.RemoveVmCommand.cloneContextAndDetachFromParent ( ) ) ; if ( ! ( retVal.getSucceeded ( ) ) ) { log.error ( "Failed to remove memory volumes while removing vm '{}' (volumes: '{}')" , org.ovirt.engine.core.bll.RemoveVmCommand.getVmId ( ) , memoryState ) ; } } }
Source:
public boolean poll ( ) { waitBetweenPolls ( ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "Request to do poll for host {}." , parameters.getVdsId ( ) ) ; org.ovirt.engine.core.common.interfaces.FutureVDSCall < org.ovirt.engine.core.common.vdscommands.VDSReturnValue > task = org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.bll.interfaces.BackendInternal.class ) . getResourceManager ( ) . runFutureVdsCommand ( FutureVDSCommandType.Poll , parameters ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "FutureVDSCommandType.Poll executed for host{}." , parameters.getVdsId ( ) ) ; boolean succeeded = getValue ( task ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "Result of FutureVDSCommandType.Poll for host {}: {}" , parameters.getVdsId ( ) , succeeded ) ; timestampOfEndOfPreviousInvocation = currentTimestamp ( ) ; return succeeded ; }

Target:
public boolean poll ( ) { waitBetweenPolls ( ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "Request to do poll for host {}." , parameters.getVdsId ( ) ) ; org.ovirt.engine.core.common.interfaces.FutureVDSCall < org.ovirt.engine.core.common.vdscommands.VDSReturnValue > task = org.ovirt.engine.core.di.Injector.get ( org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend.class ) . runFutureVdsCommand ( FutureVDSCommandType.Poll , parameters ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "FutureVDSCommandType.Poll executed for host{}." , parameters.getVdsId ( ) ) ; boolean succeeded = getValue ( task ) ; org.ovirt.engine.core.bll.network.host.HostPoller.LOGGER.trace ( "Result of FutureVDSCommandType.Poll for host {}: {}" , parameters.getVdsId ( ) , succeeded ) ; timestampOfEndOfPreviousInvocation = currentTimestamp ( ) ; return succeeded ; }
Source:
public void testIllegalImageReturnedByQuery ( ) throws java.lang.Exception { existingVm.getDiskMap ( ) . put ( existingDiskImage.getId ( ) , existingDiskImage ) ; existingVm.getImages ( ) . add ( existingDiskImage ) ; snapshotVmConfigurationHelper.markImagesIllegalIfNotInDb ( existingVm , existingSnapshotId ) ; for ( org.ovirt.engine.core.common.businessentities.Disk diskImage : existingVm.getDiskMap ( ) . values ( ) ) { org.junit.Assert.assertEquals ( ( ( org.ovirt.engine.core.common.businessentities.DiskImage ) ( diskImage ) ) . getImageStatus ( ) , ImageStatus.ILLEGAL ) ; } }

Target:
public void testIllegalImageReturnedByQuery ( ) throws java.lang.Exception { existingVm.getDiskMap ( ) . put ( existingDiskImage.getId ( ) , existingDiskImage ) ; existingVm.getImages ( ) . add ( existingDiskImage ) ; snapshotVmConfigurationHelper.markImagesIllegalIfNotInDb ( existingVm , existingSnapshotId ) ; for ( org.ovirt.engine.core.common.businessentities.storage.Disk diskImage : existingVm.getDiskMap ( ) . values ( ) ) { org.junit.Assert.assertEquals ( ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( diskImage ) ) . getImageStatus ( ) , ImageStatus.ILLEGAL ) ; } }
Source:
public void writeAttribute ( java.lang.String name , java.lang.String value ) { try { writer.writeAttribute ( name , value ) ; } catch ( javax.xml.stream.XMLStreamException exception ) { throw new org.ovirt.api.metamodel.tool.XmlWriterException ( ( ( ( ( "Can\'t write attribute with name \"" + name ) + "\" and value \"" ) + value ) + "\"" ) , exception ) ; } }

Target:
public void writeAttribute ( java.lang.String name , java.lang.String value ) { try { writer.writeAttribute ( name , value ) ; } catch ( javax.xml.stream.XMLStreamException exception ) { throw new org.ovirt.api.metamodel.runtime.xml.XmlException ( ( ( ( ( "Can\'t write attribute with name \"" + name ) + "\" and value \"" ) + value ) + "\"" ) , exception ) ; } }
Source:
private static java.util.List < org.ovirt.engine.core.aaa.DirectoryUser > queryPrincipals ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final org.ovirt.engine.api.extensions.ExtMap filter , boolean recursiveGroupsResolving ) { return org.ovirt.engine.core.aaa.AuthzUtils.populatePrincipals ( extension , new org.ovirt.engine.api.extensions.ExtMap ( ) . mput ( Authz.InvokeKeys.QUERY_ENTITY , Authz.QueryEntity.PRINCIPAL ) . mput ( Authz.InvokeKeys.RESOLVE_GROUPS_RECURSIVE , recursiveGroupsResolving ) . mput ( Authz.InvokeKeys.QUERY_FILTER , filter ) ) ; }

Target:
private static java.util.List < org.ovirt.engine.core.aaa.DirectoryUser > queryPrincipals ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final java.lang.String namespace , final org.ovirt.engine.api.extensions.ExtMap filter , boolean recursiveGroupsResolving ) { org.ovirt.engine.api.extensions.ExtMap inputMap = new org.ovirt.engine.api.extensions.ExtMap ( ) . mput ( Authz.InvokeKeys.QUERY_ENTITY , Authz.QueryEntity.PRINCIPAL ) . mput ( Authz.InvokeKeys.RESOLVE_GROUPS_RECURSIVE , recursiveGroupsResolving ) . mput ( Authz.InvokeKeys.QUERY_FILTER , filter ) . mput ( Authz.InvokeKeys.NAMESPACE , namespace ) ; return org.ovirt.engine.core.aaa.AuthzUtils.populatePrincipals ( extension , namespace , inputMap ) ; }
Source:
public void testGetLunsToUpdateInDbLunExistsInDbButNoInVgInfo ( ) { org.ovirt.engine.core.compat.Guid lunFromDbId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.LUNs > lunsToRemoveFromDb = getLunsToUpdateInDb ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , lunFromDbId , org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.compat.Guid.newGuid ( ) ) . get ( command.removeLuns ) ; assertLunIdInList ( lunsToRemoveFromDb , lunFromDbId ) ; }

Target:
public void testGetLunsToUpdateInDbLunExistsInDbButNotInVgInfo ( ) { org.ovirt.engine.core.compat.Guid lunFromDbId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; java.util.List < org.ovirt.engine.core.common.businessentities.storage.LUNs > lunsToRemoveFromDb = getLunsToUpdateInDb ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , lunFromDbId , org.ovirt.engine.core.compat.Guid.newGuid ( ) , org.ovirt.engine.core.compat.Guid.newGuid ( ) ) . get ( command.removeLunsHandler ) ; assertLunIdInList ( lunsToRemoveFromDb , lunFromDbId ) ; }
Source:
protected boolean validateVmProperties ( org.ovirt.engine.core.common.businessentities.VM vm , java.util.List < java.lang.String > messages ) { java.util.List < org.ovirt.engine.core.utils.customprop.ValidationError > validationErrors = getVmPropertiesUtils ( ) . validateVMProperties ( vm.getVdsGroupCompatibilityVersion ( ) , vm.getStaticData ( ) ) ; if ( ! ( validationErrors.isEmpty ( ) ) ) { org.ovirt.engine.core.utils.customprop.VmPropertiesUtils.getInstance ( ) . handleCustomPropertiesError ( validationErrors , messages ) ; return false ; } return true ; }

Target:
protected boolean validateVmProperties ( org.ovirt.engine.core.common.businessentities.VM vm , java.lang.String runOnceCustomProperties , java.util.List < java.lang.String > messages ) { java.lang.String customProperties = ( runOnceCustomProperties != null ) ? runOnceCustomProperties : vm.getCustomProperties ( ) ; return getVmPropertiesUtils ( ) . validateVmProperties ( vm.getVdsGroupCompatibilityVersion ( ) , customProperties , messages ) ; }
Source:
public void executeCommandWhenFailed ( ) { setupMocks ( ) ; org.mockito.Mockito.doThrow ( new org.ovirt.engine.core.common.errors.EngineException ( org.ovirt.engine.core.common.errors.EngineError.GlusterHookListException ) ) . when ( hookSyncJob ) . refreshHooksInCluster ( getCluster ( ) , true ) ; try { cmd.executeCommand ( ) ; org.junit.Assert.fail ( "Expected EngineException" ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException e ) { org.junit.Assert.assertEquals ( EngineError.GlusterHookListException , e.getErrorCode ( ) ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_REFRESH_FAILED , cmd.getAuditLogTypeValue ( ) ) ; } }

Target:
public void executeCommandWhenFailed ( ) { setupMocks ( ) ; org.mockito.Mockito.doThrow ( new org.ovirt.engine.core.common.errors.EngineException ( org.ovirt.engine.core.common.errors.EngineError.GlusterHookListException ) ) . when ( hookSyncJob ) . refreshHooksInCluster ( getCluster ( ) , true ) ; try { cmd.executeCommand ( ) ; org.junit.jupiter.api.Assertions.fail ( "Expected EngineException" ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException e ) { org.junit.jupiter.api.Assertions.assertEquals ( EngineError.GlusterHookListException , e.getErrorCode ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( AuditLogType.GLUSTER_HOOK_REFRESH_FAILED , cmd.getAuditLogTypeValue ( ) ) ; } }
Source:
private void mockDiskValidator ( ) { org.mockito.Mockito.doReturn ( diskValidator ) . when ( command ) . getDiskValidator ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.Disk.class ) ) ; org.mockito.Mockito.when ( diskValidator.isReadOnlyPropertyCompatibleWithInterface ( ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( diskValidator.isVirtIoScsiValid ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( diskValidator.isDiskInterfaceSupported ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; }

Target:
private void mockDiskValidator ( ) { org.mockito.Mockito.doReturn ( diskValidator ) . when ( command ) . getDiskValidator ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.storage.Disk.class ) ) ; org.mockito.Mockito.when ( diskValidator.isReadOnlyPropertyCompatibleWithInterface ( ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( diskValidator.isVirtIoScsiValid ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( diskValidator.isDiskInterfaceSupported ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; }
Source:
public boolean getTaskGroupSuccess ( ) { boolean childrenTasksSuccess = taskGroupSuccess ; if ( ( imagesParameters ) != null ) { for ( org.ovirt.engine.core.common.action.VdcActionParametersBase childParameters : imagesParameters ) { childrenTasksSuccess &= childParameters.getTaskGroupSuccess ( ) ; if ( ! childrenTasksSuccess ) { break ; } } } return childrenTasksSuccess ; }

Target:
public boolean getTaskGroupSuccess ( ) { boolean childrenTasksSuccess = taskGroupSuccess ; if ( ( imagesParameters ) != null ) { for ( org.ovirt.engine.core.common.action.ActionParametersBase childParameters : imagesParameters ) { childrenTasksSuccess &= childParameters.getTaskGroupSuccess ( ) ; if ( ! childrenTasksSuccess ) { break ; } } } return childrenTasksSuccess ; }
Source:
protected javax.ws.rs.core.Response performCreation ( org.ovirt.engine.core.common.action.VdcActionType task , org.ovirt.engine.core.common.action.VdcActionParametersBase taskParams , org.ovirt.engine.api.restapi.resource.EntityIdResolver entityResolver , java.lang.Class < ? extends org.ovirt.engine.api.model.BaseResource > suggestedParentType ) { return performCreation ( task , taskParams , entityResolver , expectBlocking ( ) , suggestedParentType ) ; }

Target:
protected < T > javax.ws.rs.core.Response performCreation ( org.ovirt.engine.core.common.action.VdcActionType task , org.ovirt.engine.core.common.action.VdcActionParametersBase taskParams , org.ovirt.engine.api.restapi.resource.IResolver < T , Q > entityResolver , java.lang.Class < ? extends org.ovirt.engine.api.model.BaseResource > suggestedParentType ) { return performCreation ( task , taskParams , entityResolver , expectBlocking ( ) , suggestedParentType ) ; }
Source:
private void setModelList ( final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderGeneralModel providerGeneralModel , final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel providerNetworkListModel ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.HasEntity < org.ovirt.engine.core.common.businessentities.Provider > > list = new java.util.ArrayList < > ( ) ; list.add ( providerGeneralModel ) ; list.add ( providerNetworkListModel ) ; setDetailModels ( list ) ; }

Target:
private void setModelList ( final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderGeneralModel providerGeneralModel , final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderNetworkListModel providerNetworkListModel , final org.ovirt.engine.ui.uicommonweb.models.providers.ProviderSecretListModel providerSecretListModel ) { java.util.List < org.ovirt.engine.ui.uicommonweb.models.HasEntity < org.ovirt.engine.core.common.businessentities.Provider > > list = new java.util.ArrayList < > ( ) ; list.add ( providerGeneralModel ) ; list.add ( providerNetworkListModel ) ; list.add ( providerSecretListModel ) ; setDetailModels ( list ) ; }
Source:
public org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore score ( ) { prepare ( ) ; org.optaplanner.core.impl.score.director.ScoreDirector director = solver.getScoreDirectorFactory ( ) . buildScoreDirector ( ) ; director.setWorkingSolution ( bestSolution ) ; return ( ( org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore ) ( director.calculateScore ( ) ) ) ; }

Target:
public org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore score ( ) { prepare ( ) ; org.optaplanner.core.impl.score.director.ScoreDirector director = solver.getScoreDirectorFactory ( ) . buildScoreDirector ( ) ; director.setWorkingSolution ( bestSolution ) ; org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore score = ( ( org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore ) ( director.calculateScore ( ) ) ) ; cleanup ( ) ; return score ; }
Source:
public void fakeVlanNicWithVmNetworkDenied ( ) { org.ovirt.engine.core.common.businessentities.network.Network net1 = createNetwork ( "net1" ) ; org.ovirt.engine.core.common.businessentities.network.Network net2 = createNetwork ( "net2" ) ; net2.setVlanId ( 100 ) ; mockExistingNetworks ( net1 , net2 ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net1 ) ; mockExistingIfaces ( nic ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface fakeVlanNic = createVlan ( nic.getName ( ) , 100 , net2.getName ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic , fakeVlanNic ) ) ; validateAndExpectViolation ( helper , VdcBllMessages.NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK , nic.getName ( ) ) ; }

Target:
public void fakeVlanNicWithVmNetworkDenied ( ) { org.ovirt.engine.core.common.businessentities.network.Network net1 = createNetwork ( "net1" ) ; org.ovirt.engine.core.common.businessentities.network.Network net2 = createNetwork ( "net2" ) ; net2.setVlanId ( 100 ) ; mockExistingNetworks ( net1 , net2 ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic = createNicSyncedWithNetwork ( "nic0" , net1 ) ; mockExistingIfaces ( nic ) ; org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface fakeVlanNic = createVlan ( nic.getName ( ) , 100 , net2.getName ( ) ) ; org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper = createHelper ( createParametersForNics ( nic , fakeVlanNic ) ) ; validateAndExpectViolation ( helper , EngineMessage.NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK , nic.getName ( ) ) ; }
Source:
public void failsInNotImportedAndNotExists ( ) throws java.lang.Exception { mockGetExistingDomain ( false ) ; cmd.init ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( "" , cmd , EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST ) ; org.mockito.Mockito.verify ( backend , org.mockito.Mockito.times ( 1 ) ) . runInternalQuery ( org.mockito.Matchers.eq ( VdcQueryType.GetExistingStorageDomainList ) , org.mockito.Matchers.any ( org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class ) ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.times ( 0 ) ) . executeCommand ( ) ; }

Target:
public void failsInNotImportedAndNotExists ( ) throws java.lang.Exception { mockGetExistingDomain ( false ) ; cmd.init ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( "" , cmd , EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST ) ; org.mockito.Mockito.verify ( backend , org.mockito.Mockito.times ( 1 ) ) . runInternalQuery ( org.mockito.ArgumentMatchers.eq ( VdcQueryType.GetExistingStorageDomainList ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.queries.VdcQueryParametersBase.class ) ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.times ( 0 ) ) . executeCommand ( ) ; }
Source:
public void testBootProtocolSetForDisplayNetworkWhenBootProtocolIsNone ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network ( ) ; network.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment = createNetworkAttachmentWithIpConfiguration ( NetworkBootProtocol.NONE , null , null ) ; attachment.setNetworkId ( network.getId ( ) ) ; doTestBootProtocolSetForDisplayNetworkWhenNullValuedIpConfigurationAndWhenNetworkClusterDisplayIsFalse ( true , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_DISPLAY_NETWORK_HAS_NO_BOOT_PROTOCOL ) , network , attachment ) ; }

Target:
public void testBootProtocolSetForDisplayNetworkWhenBootProtocolIsNone ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Network network = createNetwork ( ) ; org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment = createNetworkAttachmentWithIpConfiguration ( NetworkBootProtocol.NONE , null , null ) ; attachment.setNetworkId ( network.getId ( ) ) ; doTestBootProtocolSetForDisplayNetworkWhenNullValuedIpConfigurationAndWhenNetworkClusterDisplay ( true , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_DISPLAY_NETWORK_HAS_NO_BOOT_PROTOCOL , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( NetworkAttachmentValidator.VAR_ACTION_TYPE_FAILED_DISPLAY_NETWORK_HAS_NO_BOOT_PROTOCOL_ENTITY , network.getName ( ) ) ) , network , attachment ) ; }
Source:
public java.lang.String getStyleNames ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalItemModel row , int rowIndex ) { if ( row == null ) { return null ; } if ( isSelectedRow ( row ) ) { return null ; } return row.IsVmUp ( ) ? applicationResources.sideTabExtendedVmStyle ( ) . vmUpRow ( ) : applicationResources.sideTabExtendedVmStyle ( ) . vmDownRow ( ) ; }

Target:
public java.lang.String getStyleNames ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalItemModel row , int rowIndex ) { if ( row == null ) { return null ; } if ( isSelectedRow ( row ) ) { return null ; } return row.isVmUp ( ) ? applicationResources.sideTabExtendedVmStyle ( ) . vmUpRow ( ) : applicationResources.sideTabExtendedVmStyle ( ) . vmDownRow ( ) ; }
Source:
protected boolean canDoAction ( ) { org.ovirt.engine.core.bll.validator.StorageConnectionValidator storageConnectionValidator = createStorageConnectionValidator ( ) ; if ( ( ( ! ( validate ( storageConnectionValidator.isConnectionExists ( ) ) ) ) || ( ! ( validate ( storageConnectionValidator.isDomainOfConnectionExistsAndInactive ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) ) ) ) || ( ! ( validate ( storageConnectionValidator.isISCSIConnectionAndDomain ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) ) ) ) { return false ; } if ( storageConnectionValidator.isConnectionForISCSIDomainAttached ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_FOR_DOMAIN_ALREADY_EXISTS ) ; } return true ; }

Target:
protected boolean canDoAction ( ) { org.ovirt.engine.core.bll.validator.storage.StorageConnectionValidator storageConnectionValidator = createStorageConnectionValidator ( ) ; if ( ( ( ! ( validate ( storageConnectionValidator.isConnectionExists ( ) ) ) ) || ( ! ( validate ( storageConnectionValidator.isDomainOfConnectionExistsAndInactive ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) ) ) ) || ( ! ( validate ( storageConnectionValidator.isISCSIConnectionAndDomain ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) ) ) ) { return false ; } if ( storageConnectionValidator.isConnectionForISCSIDomainAttached ( org.ovirt.engine.core.bll.storage.AttachStorageConnectionToStorageDomainCommand.getStorageDomain ( ) ) ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_FOR_DOMAIN_ALREADY_EXISTS ) ; } return true ; }