auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetAllByImageId ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap > result = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap mapping : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID , mapping.getimage_id ( ) ) ; } }

Target:
public void testGetAllByImageId ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap > result = dao.getAllByImageId ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.storage.ImageStorageDomainMap mapping : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.ImageStorageDomainMapDaoTest.EXISTING_IMAGE_ID , mapping.getImageId ( ) ) ; } }
Source:
public void canDoActionThinProvisioningSpaceCheckSucceeds ( ) throws java.lang.Exception { final int availableSize = 6 ; final int usedSize = 4 ; org.ovirt.engine.core.compat.Guid sdid = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; initializeCommand ( sdid , VolumeType.Sparse ) ; mockVm ( ) ; mockStorageDomain ( sdid , availableSize , usedSize ) ; mockStoragePoolIsoMap ( ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }

Target:
public void canDoActionSpaceValidationSucceeds ( ) { org.ovirt.engine.core.compat.Guid storageId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; initializeCommand ( storageId , VolumeType.Preallocated ) ; mockVm ( ) ; mockStorageDomain ( storageId ) ; mockStoragePoolIsoMap ( ) ; mockInterfaceList ( ) ; mockMaxPciSlots ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.AddDiskToVmCommandTest.mockStorageDomainValidatorWithSpace ( ) ) . when ( command ) . createStorageDomainValidator ( ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }
Source:
protected void syncSearch ( ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetAllVmTemplates ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalTemplateListModel ) ( model ) ) . setItems ( ( ( java.lang.Iterable ) ( returnValue ) ) ) ; } } ) ) ; }

Target:
protected void syncSearch ( ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getAllVmTemplates ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { ( ( org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalTemplateListModel ) ( model ) ) . setItems ( ( ( java.lang.Iterable ) ( returnValue ) ) ) ; } } ) ) ; }
Source:
private void init ( ) { org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil.setExecutorService ( new org.ovirt.engine.core.common.utils.EngineThreadPools.InternalThreadExecutor ( "EngineThreadPool" , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_MIN_SIZE" ) , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_MAX_SIZE" ) , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_QUEUE_SIZE" ) ) ) ; }

Target:
private void init ( ) { org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil.setExecutorService ( new org.ovirt.engine.core.common.utils.InternalThreadExecutor ( "EngineThreadPool" , org.ovirt.engine.core.common.utils.EngineThreadPools.threadFactory , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_MIN_SIZE" ) , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_MAX_SIZE" ) , org.ovirt.engine.core.utils.EngineLocalConfig.getInstance ( ) . getInteger ( "ENGINE_THREAD_POOL_QUEUE_SIZE" ) ) ) ; }
Source:
protected void doTestExport ( org.ovirt.engine.api.model.StorageDomain storageDomain , boolean exclusive ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( VdcActionType.ExportVmTemplate , org.ovirt.engine.core.common.action.MoveOrCopyParameters.class , new java.lang.String [ ] { "ContainerId" , "StorageDomainId" , "ForceOverride" } , new java.lang.Object [ ] { GUIDS [ 0 ] , GUIDS [ 2 ] , exclusive } ) ) ; org.ovirt.engine.api.model.Action action = new org.ovirt.engine.api.model.Action ( ) ; action.setStorageDomain ( storageDomain ) ; if ( exclusive ) { action.setExclusive ( exclusive ) ; } verifyActionResponse ( resource.export ( action ) ) ; }

Target:
protected void doTestExport ( org.ovirt.engine.api.model.StorageDomain storageDomain , boolean exclusive ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( ActionType.ExportVmTemplate , org.ovirt.engine.core.common.action.MoveOrCopyParameters.class , new java.lang.String [ ] { "ContainerId" , "StorageDomainId" , "ForceOverride" } , new java.lang.Object [ ] { GUIDS [ 0 ] , GUIDS [ 2 ] , exclusive } ) ) ; org.ovirt.engine.api.model.Action action = new org.ovirt.engine.api.model.Action ( ) ; action.setStorageDomain ( storageDomain ) ; if ( exclusive ) { action.setExclusive ( exclusive ) ; } verifyActionResponse ( resource.export ( action ) ) ; }
Source:
public void testGetServerHooks ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook serverHook1 = getGlusterServerHook ( org.ovirt.engine.core.dao.gluster.GlusterHooksDaoTest.SERVER_ID , GlusterHookStatus.ENABLED , GlusterHookContentType.TEXT , org.ovirt.engine.core.dao.gluster.GlusterHooksDaoTest.CHECKSUM_HOOK1_SERVER1 ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook serverHook2 = getGlusterServerHook ( FixturesTool.GLUSTER_BRICK_SERVER1 , GlusterHookStatus.MISSING , null , null ) ; java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook > serverHooks = dao.getGlusterServerHooks ( FixturesTool.HOOK_ID ) ; org.junit.Assert.assertNotNull ( serverHooks ) ; org.junit.Assert.assertEquals ( 2 , serverHooks.size ( ) ) ; org.junit.Assert.assertTrue ( serverHooks.contains ( serverHook1 ) ) ; org.junit.Assert.assertTrue ( serverHooks.contains ( serverHook2 ) ) ; }

Target:
public void testGetServerHooks ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook serverHook1 = getGlusterServerHook ( FixturesTool.VDS_GLUSTER_SERVER2 , GlusterHookStatus.ENABLED , GlusterHookContentType.TEXT , org.ovirt.engine.core.dao.gluster.GlusterHooksDaoTest.CHECKSUM_HOOK1_SERVER1 ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook serverHook2 = getGlusterServerHook ( FixturesTool.GLUSTER_BRICK_SERVER1 , GlusterHookStatus.MISSING , null , null ) ; java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook > serverHooks = dao.getGlusterServerHooks ( FixturesTool.HOOK_ID ) ; org.junit.Assert.assertNotNull ( serverHooks ) ; org.junit.Assert.assertEquals ( 2 , serverHooks.size ( ) ) ; org.junit.Assert.assertTrue ( serverHooks.contains ( serverHook1 ) ) ; org.junit.Assert.assertTrue ( serverHooks.contains ( serverHook2 ) ) ; }
Source:
private void updateActionAvailability ( ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > disks = ( ( getSelectedItems ( ) ) != null ) ? org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.DiskImage > Cast ( getSelectedItems ( ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ; getRemoveCommand ( ) . setIsExecutionAllowed ( ( ( ( disks.size ( ) ) > 0 ) && ( isRemoveCommandAvailable ( disks ) ) ) ) ; }

Target:
private void updateActionAvailability ( ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > disks = ( ( getSelectedItems ( ) ) != null ) ? org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.DiskImage > cast ( getSelectedItems ( ) ) : new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskImage > ( ) ; getRemoveCommand ( ) . setIsExecutionAllowed ( ( ( ( disks.size ( ) ) > 0 ) && ( isRemoveCommandAvailable ( disks ) ) ) ) ; }
Source:
private void endVmRelatedOps ( ) { org.ovirt.engine.core.bll.ImportVmCommand.setVm ( null ) ; if ( ( getVm ( ) ) != null ) { org.ovirt.engine.core.bll.VmHandler.UnLockVm ( getVm ( ) ) ; } else { org.ovirt.engine.core.bll.ImportVmCommand.setCommandShouldBeLogged ( false ) ; org.ovirt.engine.core.bll.ImportVmCommand.log.warn ( "ImportVmCommand::EndImportCommand: Vm is null - not performing full EndAction" ) ; } }

Target:
private void endVmRelatedOps ( ) { org.ovirt.engine.core.bll.ImportVmCommand.setVm ( null ) ; if ( ( getVm ( ) ) != null ) { org.ovirt.engine.core.bll.VmHandler.unLockVm ( getVm ( ) ) ; } else { org.ovirt.engine.core.bll.ImportVmCommand.setCommandShouldBeLogged ( false ) ; org.ovirt.engine.core.bll.ImportVmCommand.log.warn ( "ImportVmCommand::EndImportCommand: Vm is null - not performing full EndAction" ) ; } }
Source:
public void validateFailsForCluster ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; mockIsGlusterEnabled ( false ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; mockIsGlusterEnabled ( true ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
public void validateSucceeds ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Collections.singletonList ( getStorageDevice ( "sda" ) ) ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertTrue ( cmd.validate ( ) ) ; }
Source:
public boolean validateCinder ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.CinderDisk > cinderDisks = org.ovirt.engine.core.bll.ImagesHandler.filterDisksBasedOnCinder ( org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDiskDao ( ) . getAllForVm ( org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.getVmId ( ) ) ) ; if ( ! ( cinderDisks.isEmpty ( ) ) ) { org.ovirt.engine.core.bll.validator.storage.CinderDisksValidator cinderDisksValidator = getCinderDisksValidator ( cinderDisks ) ; return validate ( cinderDisksValidator.validateCinderDiskLimits ( ) ) ; } return true ; }

Target:
public boolean validateCinder ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage.CinderDisk > cinderDisks = org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.filterDisksBasedOnCinder ( org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getDiskDao ( ) . getAllForVm ( org.ovirt.engine.core.bll.snapshots.TryBackToAllSnapshotsOfVmCommand.getVmId ( ) ) ) ; if ( ! ( cinderDisks.isEmpty ( ) ) ) { org.ovirt.engine.core.bll.validator.storage.CinderDisksValidator cinderDisksValidator = getCinderDisksValidator ( cinderDisks ) ; return validate ( cinderDisksValidator.validateCinderDiskLimits ( ) ) ; } return true ; }
Source:
public void testGetAllInterfacesByLabelForCluster ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > interfaces = dao.getAllInterfacesByLabelForCluster ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.CLUSTER_ID , org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.LABEL ) ; org.junit.Assert.assertNotNull ( interfaces ) ; org.junit.Assert.assertFalse ( interfaces.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic : interfaces ) { org.junit.Assert.assertTrue ( nic.getLabels ( ) . contains ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.LABEL ) ) ; } }

Target:
public void testGetAllInterfacesByLabelForCluster ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > interfaces = dao.getAllInterfacesByLabelForCluster ( FixturesTool.CLUSTER , org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.LABEL ) ; org.junit.Assert.assertNotNull ( interfaces ) ; org.junit.Assert.assertFalse ( interfaces.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface nic : interfaces ) { org.junit.Assert.assertTrue ( nic.getLabels ( ) . contains ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.LABEL ) ) ; } }
Source:
public void validateFailedDiscardNotSupported ( ) { mockVmStatusUp ( ) ; mockInterfaceList ( ) ; createVirtIODisk ( ) ; initStorageDomain ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE ) ) . when ( diskVmElementValidator ) . isPassDiscardSupported ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE ) ; }

Target:
public void validateFailedDiscardNotSupported ( ) { mockVmStatusUp ( ) ; mockInterfaceList ( ) ; createVirtIODisk ( ) ; initStorageDomain ( ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE ) ) . when ( diskVmElementValidator ) . isPassDiscardSupported ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateFailure ( command , EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE ) ; }
Source:
public void testList_LimitResults ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectationsWithMax ( false ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.Tag > results = getCollection ( ) ; assertNotNull ( collection ) ; assertEquals ( 2 , results.size ( ) ) ; }

Target:
public void testList_LimitResults ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectationsWithMax ( false ) ; setUpQueryExpectations ( "" ) ; collection.setUriInfo ( uriInfo ) ; java.util.List < org.ovirt.engine.api.model.Tag > results = getCollection ( ) ; assertNotNull ( collection ) ; assertEquals ( 3 , results.size ( ) ) ; }
Source:
public void updateId ( ) { org.ovirt.engine.core.common.businessentities.Snapshot snapshot = dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertNotNull ( snapshot ) ; org.ovirt.engine.core.compat.Guid oldId = snapshot.getId ( ) ; snapshot.setId ( Guid.Empty ) ; dao.updateId ( oldId , snapshot.getId ( ) ) ; org.junit.Assert.assertEquals ( snapshot , dao.get ( snapshot.getId ( ) ) ) ; }

Target:
public void updateId ( ) { org.ovirt.engine.core.common.businessentities.Snapshot snapshot = dao.get ( getExistingEntityId ( ) ) ; org.junit.jupiter.api.Assertions.assertNotNull ( snapshot ) ; org.ovirt.engine.core.compat.Guid oldId = snapshot.getId ( ) ; snapshot.setId ( Guid.Empty ) ; dao.updateId ( oldId , snapshot.getId ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( snapshot , dao.get ( snapshot.getId ( ) ) ) ; }
Source:
private void initComparators ( ) { java.util.List < ? extends java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > > comparators = java.util.Arrays.asList ( new org.ovirt.engine.core.bll.memory.MemoryStorageHandlerTest.SmallestStorageDomainComparator ( validStorageDomain2 ) , new org.ovirt.engine.core.bll.memory.MemoryStorageHandlerTest.BiggestStorageDomainComparator ( validStorageDomain3 ) ) ; org.mockito.Mockito.doReturn ( comparators ) . when ( memoryStorageHandler ) . getStorageDomainComparators ( org.mockito.Matchers.anyListOf ( org.ovirt.engine.core.common.businessentities.storage.DiskImage.class ) ) ; }

Target:
private void initComparators ( ) { java.util.List < ? extends java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > > comparators = java.util.Arrays.asList ( new org.ovirt.engine.core.bll.memory.MemoryStorageHandlerTest.SmallestStorageDomainComparator ( validStorageDomain2 ) , new org.ovirt.engine.core.bll.memory.MemoryStorageHandlerTest.BiggestStorageDomainComparator ( validStorageDomain3 ) ) ; org.mockito.Mockito.doReturn ( comparators ) . when ( memoryStorageHandler ) . getStorageDomainComparators ( org.mockito.ArgumentMatchers.anyListOf ( org.ovirt.engine.core.common.businessentities.storage.DiskImage.class ) ) ; }
Source:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { callback.vnicCreated ( vmId ) ; }

Target:
public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { org.ovirt.engine.ui.frontend.Frontend.RunMultipleAction ( VdcActionType.UpdateVmInterface , updateVnicParameters , new org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { org.ovirt.engine.ui.frontend.Frontend.RunMultipleAction ( VdcActionType.RemoveVmInterface , removeVnicParameters , new org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback ( ) { @ java.lang.Override public void executed ( org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult result ) { callback.vnicCreated ( vmId ) ; } } , this ) ; } } , this ) ; }
Source:
public java.lang.String answer ( org.mockito.invocation.InvocationOnMock invocation ) throws java.lang.Throwable { org.ovirt.engine.core.common.businessentities.VM vm = ( ( org.ovirt.engine.core.common.businessentities.VM ) ( invocation.getArguments ( ) [ 0 ] ) ) ; return vm.getId ( ) . toString ( ) ; }

Target:
public java.lang.Object answer ( org.mockito.invocation.InvocationOnMock invocation ) throws java.lang.Throwable { org.ovirt.engine.core.compat.Guid storagePoolId = ( ( org.ovirt.engine.core.compat.Guid ) ( invocation.getArguments ( ) [ 0 ] ) ) ; org.ovirt.engine.core.compat.Guid storageDomainId = ( ( org.ovirt.engine.core.compat.Guid ) ( invocation.getArguments ( ) [ 1 ] ) ) ; map.get ( storagePoolId ) . put ( storageDomainId , java.lang.Boolean.TRUE ) ; return null ; }
Source:
private boolean isAttachmentShouldBeRemoved ( java.lang.String networkName , java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > targetNetworksByName ) { org.ovirt.engine.core.common.businessentities.network.Network targetNetwork = targetNetworksByName.get ( networkName ) ; return ! ( ( org.ovirt.engine.core.utils.NetworkUtils.isLabeled ( targetNetwork ) ) && ( isHostContainLabel ( targetNetwork.getLabel ( ) ) ) ) ; }

Target:
private boolean isNetworkLabelExistInTargetHost ( org.ovirt.engine.core.compat.Guid hostId , java.lang.String networkName , java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > targetNetworksByName ) { org.ovirt.engine.core.common.businessentities.network.Network targetNetwork = targetNetworksByName.get ( networkName ) ; return ( org.ovirt.engine.core.utils.NetworkUtils.isLabeled ( targetNetwork ) ) && ( isHostContainLabel ( hostId , targetNetwork.getLabel ( ) ) ) ; }
Source:
private static void addContextMessage ( org.ovirt.engine.api.extensions.ExtMap context , boolean error , java.lang.String message ) { org.ovirt.engine.api.extensions.ExtKey key ; if ( error ) { key = org.ovirt.engine.extension.aaa.jdbc.binding.cli.Cli.ContextKeys.ERR_MESSAGES ; } else { key = org.ovirt.engine.extension.aaa.jdbc.binding.cli.Cli.ContextKeys.OUT_MESSAGES ; } ( ( java.util.List < java.lang.String > ) ( context.get ( key , java.util.List.class ) ) ) . add ( message ) ; }

Target:
private static void addContextMessage ( org.ovirt.engine.api.extensions.ExtMap context , boolean error , java.lang.String message ) { org.ovirt.engine.api.extensions.ExtKey key ; if ( error ) { key = ContextKeys.ERR_MESSAGES ; } else { key = ContextKeys.OUT_MESSAGES ; } ( ( java.util.List < java.lang.String > ) ( context.get ( key , java.util.List.class ) ) ) . add ( message ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue2 ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskInterface > diskInterfaces = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskInterface > ) ( returnValue2 ) ) ; if ( isVirtioScsiDisabled ) { diskInterfaces.remove ( DiskInterface.VirtIO_SCSI ) ; } setInterfaces ( diskInterfaces ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue2 ) { java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskInterface > diskInterfaces = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.DiskInterface > ) ( returnValue2 ) ) ; if ( java.lang.Boolean.FALSE.equals ( getIsVirtioScsiEnabled ( ) . getEntity ( ) ) ) { diskInterfaces.remove ( DiskInterface.VirtIO_SCSI ) ; } setInterfaces ( diskInterfaces ) ; }
Source:
public void testRemove ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 , true ) ; setUpActionExpectations ( VdcActionType.RemoveAffinityGroup , org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters.class , new java.lang.String [ ] { "AffinityGroupId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , true , true ) ; verifyRemove ( resource.remove ( ) ) ; }

Target:
public void testRemove ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 1 , true ) ; setUpActionExpectations ( ActionType.RemoveAffinityGroup , org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters.class , new java.lang.String [ ] { "AffinityGroupId" } , new java.lang.Object [ ] { GUIDS [ 0 ] } , true , true ) ; verifyRemove ( resource.remove ( ) ) ; }
Source:
protected void readOsSection ( org.ovirt.engine.core.utils.ovf.xml.XmlNode section ) { _vm.getStaticData ( ) . setId ( new org.ovirt.engine.core.compat.Guid ( section.attributes.get ( "ovf:id" ) . getValue ( ) ) ) ; org.ovirt.engine.core.utils.ovf.xml.XmlNode node = section.SelectSingleNode ( "Description" ) ; if ( node != null ) { int osId = osRepository.getOsIdByUniqueName ( node.innerText ) ; _vm.getStaticData ( ) . setOsId ( osId ) ; _vm.setClusterArch ( osRepository.getArchitectureFromOS ( osId ) ) ; } else { _vm.setClusterArch ( ArchitectureType.undefined ) ; } }

Target:
protected void readOsSection ( org.ovirt.engine.core.utils.ovf.xml.XmlNode section ) { _vm.getStaticData ( ) . setId ( new org.ovirt.engine.core.compat.Guid ( section.attributes.get ( "ovf:id" ) . getValue ( ) ) ) ; org.ovirt.engine.core.utils.ovf.xml.XmlNode node = selectSingleNode ( section , "Description" ) ; if ( node != null ) { int osId = osRepository.getOsIdByUniqueName ( node.innerText ) ; _vm.getStaticData ( ) . setOsId ( osId ) ; _vm.setClusterArch ( osRepository.getArchitectureFromOS ( osId ) ) ; } else { _vm.setClusterArch ( ArchitectureType.undefined ) ; } }
Source:
public void nameIsUsed ( ) { org.mockito.Mockito.when ( hostDao.getByName ( org.mockito.Matchers.any ( java.lang.String.class ) ) ) . thenReturn ( org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.VDS.class ) ) ; org.mockito.Mockito.when ( dbFacade.getVdsDao ( ) ) . thenReturn ( hostDao ) ; validator = new org.ovirt.engine.core.bll.validator.HostValidator ( dbFacade , host ) ; org.junit.Assert.assertThat ( validator.nameNotUsed ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_NAME_ALREADY_USED ) ) ; }

Target:
public void nameNotUsed ( ) { org.mockito.Mockito.when ( hostDao.getByName ( org.mockito.Matchers.any ( java.lang.String.class ) ) ) . thenReturn ( null ) ; org.mockito.Mockito.when ( dbFacade.getVdsDao ( ) ) . thenReturn ( hostDao ) ; validator = new org.ovirt.engine.core.bll.validator.HostValidator ( dbFacade , host , hostedEngineHelper ) ; org.junit.Assert.assertThat ( validator.nameNotUsed ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
public void testTypedFile ( ) throws java.lang.Exception { java.io.File file = writeConf ( "a=b" ) ; org.ovirt.engine.core.extensions.mgr.Configuration config = org.ovirt.engine.core.extensions.mgr.Configuration.loadFile ( file ) ; junit.framework.Assert.assertNotNull ( config ) ; org.ovirt.engine.core.extensions.mgr.ConfigurationTest.TypedFile view = config.getView ( org.ovirt.engine.core.extensions.mgr.ConfigurationTest.TypedFile.class ) ; junit.framework.Assert.assertNotNull ( view ) ; junit.framework.Assert.assertEquals ( new java.io.File ( "b" ) , view.getA ( ) ) ; }

Target:
public void testTypedFile ( ) throws java.lang.Exception { java.io.File file = writeConf ( "a=b" ) ; org.ovirt.engine.core.extensions.mgr.Configuration config = org.ovirt.engine.core.extensions.mgr.Configuration.loadFile ( file ) ; org.junit.Assert.assertNotNull ( config ) ; org.ovirt.engine.core.extensions.mgr.ConfigurationTest.TypedFile view = config.getView ( org.ovirt.engine.core.extensions.mgr.ConfigurationTest.TypedFile.class ) ; org.junit.Assert.assertNotNull ( view ) ; org.junit.Assert.assertEquals ( new java.io.File ( "b" ) , view.getA ( ) ) ; }
Source:
public java.lang.Integer getProgressValue ( org.ovirt.engine.core.common.businessentities.VM object ) { return object.getMigrationProgressPercent ( ) ; }

Target:
public java.lang.String getValue ( org.ovirt.engine.core.common.businessentities.VM vm ) { if ( ( vm.getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VMStatus.MigratingFrom ) ) { return null ; } if ( ( vm.getBackgroundOperationDescription ( ) ) != null ) { return null ; } return super . getValue ( vm ) ; }
Source:
public void testFilterWithFailingPlugin ( ) throws org.apache.xmlrpc.XmlRpcException { java.util.List < java.lang.String > result = proxy.filter ( new java.lang.String [ ] { org.ovirt.schedulerproxy.SchedulerProxyTest.CLASS_NAME , org.ovirt.schedulerproxy.SchedulerProxyTest.FAILING_CLASS_NAME } , org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ARRAY , org.ovirt.schedulerproxy.SchedulerProxyTest.VM_ID , "" ) ; org.junit.Assert.assertTrue ( ( ( result.size ( ) ) == ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ARRAY.length ) ) ) ; org.junit.Assert.assertTrue ( result.contains ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ID1 ) ) ; org.junit.Assert.assertTrue ( result.contains ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ID2 ) ) ; }

Target:
public void testFilterWithFailingPlugin ( ) throws org.apache.xmlrpc.XmlRpcException { java.util.List < java.lang.String > result = proxy.filter ( new java.lang.String [ ] { org.ovirt.schedulerproxy.SchedulerProxyTest.CLASS_NAME , org.ovirt.schedulerproxy.SchedulerProxyTest.FAILING_CLASS_NAME } , org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ARRAY , org.ovirt.schedulerproxy.SchedulerProxyTest.VM_ID , "" ) . getHosts ( ) ; org.junit.Assert.assertTrue ( ( ( result.size ( ) ) == ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ARRAY.length ) ) ) ; org.junit.Assert.assertTrue ( result.contains ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ID1 ) ) ; org.junit.Assert.assertTrue ( result.contains ( org.ovirt.schedulerproxy.SchedulerProxyTest.HOST_ID2 ) ) ; }
Source:
private static void assertDiskDescriptionMap ( org.ovirt.engine.core.common.businessentities.storage.Disk disk ) throws java.io.IOException { org.junit.Assert.assertEquals ( "Should be map of disk alias and disk description" , java.lang.String.format ( ( "{\"DiskAlias\":\"%s\"," + "\"DiskDescription\":\"%s\"}" ) , disk.getDiskAlias ( ) , org.apache.commons.lang.StringUtils.defaultString ( disk.getDiskDescription ( ) ) ) , org.ovirt.engine.core.bll.MetadataDiskDescriptionHandler.getJsonDiskDescription ( disk ) ) ; }

Target:
private void assertDiskDescriptionMap ( org.ovirt.engine.core.common.businessentities.storage.Disk disk ) throws java.io.IOException { org.junit.Assert.assertEquals ( "Should be map of disk alias and disk description" , java.lang.String.format ( ( "{\"DiskAlias\":\"%s\"," + "\"DiskDescription\":\"%s\"}" ) , disk.getDiskAlias ( ) , org.apache.commons.lang.StringUtils.defaultString ( disk.getDiskDescription ( ) ) ) , metadataDiskDescriptionHandler.getJsonDiskDescription ( disk ) ) ; }
Source:
public void testAddForceFalse ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpBasicUriExpectations ( ) ; setUriInfo ( setUpGetMatrixConstraintsExpectations ( BackendResource.FORCE_CONSTRAINT , false , "false" , uriInfo ) ) ; setUpVolumeCreationExpectations ( false ) ; collection.setParent ( org.ovirt.engine.api.restapi.resource.gluster.BackendGlusterVolumesResourceTest.parentMock ) ; javax.ws.rs.core.Response response = collection.add ( createModel ( ) ) ; org.junit.Assert.assertEquals ( 201 , response.getStatus ( ) ) ; org.junit.Assert.assertTrue ( ( ( response.getEntity ( ) ) instanceof org.ovirt.engine.api.model.GlusterVolume ) ) ; verifyModel ( ( ( org.ovirt.engine.api.model.GlusterVolume ) ( response.getEntity ( ) ) ) , 1 ) ; }

Target:
public void testAddForceFalse ( ) { javax.ws.rs.core.UriInfo uriInfo = setUpBasicUriExpectations ( ) ; setUriInfo ( setUpGetMatrixConstraintsExpectations ( BackendResource.FORCE_CONSTRAINT , false , "false" , uriInfo ) ) ; setUpVolumeCreationExpectations ( false ) ; collection.setParent ( org.ovirt.engine.api.restapi.resource.gluster.BackendGlusterVolumesResourceTest.parentMock ) ; javax.ws.rs.core.Response response = collection.add ( createModel ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( 201 , response.getStatus ( ) ) ; org.junit.jupiter.api.Assertions.assertTrue ( ( ( response.getEntity ( ) ) instanceof org.ovirt.engine.api.model.GlusterVolume ) ) ; verifyModel ( ( ( org.ovirt.engine.api.model.GlusterVolume ) ( response.getEntity ( ) ) ) , 1 ) ; }
Source:
public void setMainTabSelectedItem ( org.ovirt.engine.core.common.businessentities.VmPool selectedItem ) { driver.edit ( getDetailModel ( ) ) ; monitorCount.setText ( java.lang.String.valueOf ( getDetailModel ( ) . getMonitorCount ( ) ) ) ; isStateless.setText ( java.lang.Boolean.toString ( getDetailModel ( ) . getIsStateless ( ) ) ) ; oS.setText ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getOsName ( getDetailModel ( ) . getOS ( ) ) ) ; formBuilder.update ( getDetailModel ( ) ) ; }

Target:
public void setMainTabSelectedItem ( org.ovirt.engine.core.common.businessentities.VmPool selectedItem ) { driver.edit ( getDetailModel ( ) ) ; monitorCount.setText ( java.lang.String.valueOf ( getDetailModel ( ) . getMonitorCount ( ) ) ) ; isStateless.setText ( java.lang.Boolean.toString ( getDetailModel ( ) . getIsStateless ( ) ) ) ; oS.setText ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getOsName ( getDetailModel ( ) . getOS ( ) ) ) ; formBuilder.update ( getDetailModel ( ) ) ; defaultHost.setTitle ( getDetailModel ( ) . getDefaultHost ( ) ) ; }
Source:
public void testExecuteQueryWithDirectOnly ( ) { org.ovirt.engine.core.dao.PermissionDAO permissionDAOMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.PermissionDAO.class ) ; org.mockito.Mockito.when ( permissionDAOMock.getAllForEntity ( objectID , getUser ( ) . getId ( ) , getQueryParameters ( ) . isFiltered ( ) , false ) ) . thenReturn ( mockedPermissions ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getPermissionDao ( ) ) . thenReturn ( permissionDAOMock ) ; assertQueryDAOCall ( true ) ; }

Target:
public void testExecuteQueryWithDirectOnly ( ) { org.ovirt.engine.core.dao.PermissionDAO permissionDAOMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.PermissionDAO.class ) ; org.mockito.Mockito.when ( permissionDAOMock.getAllForEntity ( objectID , org.ovirt.engine.core.bll.UNPRIVILEGED_USER_SESSION_ID , getQueryParameters ( ) . isFiltered ( ) , false ) ) . thenReturn ( mockedPermissions ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getPermissionDao ( ) ) . thenReturn ( permissionDAOMock ) ; assertQueryDAOCall ( true ) ; }
Source:
private boolean isEditAvailable ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { if ( storageDomain == null ) { return false ; } boolean isActive = ( ( storageDomain.getstorage_domain_shared_status ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus.Active ) ) || ( ( storageDomain.getstorage_domain_shared_status ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus.Mixed ) ) ; boolean isBlockStorage = storageDomain.getstorage_type ( ) . isBlockDomain ( ) ; return isBlockStorage ? true : isActive ; }

Target:
private boolean isEditAvailable ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { if ( storageDomain == null ) { return false ; } boolean isActive = ( ( storageDomain.getStorageDomainSharedStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus.Active ) ) || ( ( storageDomain.getStorageDomainSharedStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus.Mixed ) ) ; boolean isBlockStorage = storageDomain.getStorageType ( ) . isBlockDomain ( ) ; return isBlockStorage ? true : isActive ; }
Source:
protected javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.VnicProfile vnicProfile ) { validateParameters ( vnicProfile ) ; org.ovirt.engine.core.common.action.AddVnicProfileParameters addVnicProfileParameters = new org.ovirt.engine.core.common.action.AddVnicProfileParameters ( map ( vnicProfile ) , ( ! ( vnicProfile.isSetNetworkFilter ( ) ) ) ) ; return performCreate ( ActionType.AddVnicProfile , addVnicProfileParameters , new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.VdcQueryType.GetVnicProfileById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ) ; }

Target:
protected javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.VnicProfile vnicProfile ) { validateParameters ( vnicProfile ) ; org.ovirt.engine.core.common.action.AddVnicProfileParameters addVnicProfileParameters = new org.ovirt.engine.core.common.action.AddVnicProfileParameters ( map ( vnicProfile ) , ( ! ( vnicProfile.isSetNetworkFilter ( ) ) ) ) ; return performCreate ( ActionType.AddVnicProfile , addVnicProfileParameters , new org.ovirt.engine.api.restapi.resource.QueryIdResolver < org.ovirt.engine.core.compat.Guid > ( org.ovirt.engine.core.common.queries.QueryType.GetVnicProfileById , org.ovirt.engine.core.common.queries.IdQueryParameters.class ) ) ; }
Source:
protected boolean isFencingPolicySupported ( org.ovirt.engine.core.common.businessentities.VDS proxyCandidate , org.ovirt.engine.core.compat.Version minimalSupportedVersion ) { boolean supported = ( ( fencingPolicy ) == null ) || ( proxyCandidate.getSupportedClusterVersionsSet ( ) . contains ( minimalSupportedVersion ) ) ; org.ovirt.engine.core.bll.pm.FenceProxyLocator.log.debug ( "Proxy candidate '{}' supports fencing policy '{}': {}" , proxyCandidate.getHostName ( ) , fencingPolicy , supported ) ; return supported ; }

Target:
protected boolean isFencingPolicySupported ( org.ovirt.engine.core.common.businessentities.VDS proxyCandidate , org.ovirt.engine.core.compat.Version minimalSupportedVersion ) { boolean supported = minimalSupportedVersion == null ; if ( ! supported ) { for ( org.ovirt.engine.core.compat.Version version : proxyCandidate.getSupportedClusterVersionsSet ( ) ) { if ( ( version.compareTo ( minimalSupportedVersion ) ) >= 0 ) { supported = true ; break ; } } } org.ovirt.engine.core.bll.pm.FenceProxyLocator.log.debug ( "Proxy candidate '{}' supports fencing policy '{}': {}" , proxyCandidate.getHostName ( ) , fencingPolicy , supported ) ; return supported ; }
Source:
private void setTestResultValue ( org.ovirt.engine.core.common.action.VdcReturnValueBase result ) { java.lang.String errorMessage = org.ovirt.engine.ui.uicommonweb.models.providers.ProviderModel.EMPTY_ERROR_MESSAGE ; if ( ( result == null ) || ( ! ( result.getSucceeded ( ) ) ) ) { if ( result != null ) { errorMessage = org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . translateVdcFault ( result.getFault ( ) ) ; } else { errorMessage = org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . testFailedUnknownErrorMsg ( ) ; } } getTestResult ( ) . setEntity ( errorMessage ) ; }

Target:
private void setTestResultValue ( org.ovirt.engine.core.common.action.VdcReturnValueBase result ) { java.lang.String errorMessage = org.ovirt.engine.ui.uicommonweb.models.providers.ProviderModel.EMPTY_ERROR_MESSAGE ; if ( result == null ) { errorMessage = org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . testFailedUnknownErrorMsg ( ) ; } else if ( ! ( result.getSucceeded ( ) ) ) { errorMessage = ( result.getCanDoAction ( ) ) ? org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . translateEngineFault ( result.getFault ( ) ) : org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . translateExecuteFailedMessages ( result.getCanDoActionMessages ( ) ) ; } getTestResult ( ) . setEntity ( errorMessage ) ; }
Source:
public static int parseIntegerToInt ( java.lang.String value ) { java.math.BigInteger result = javax.xml.bind.DatatypeConverter.parseInteger ( value ) ; if ( ( result.longValue ( ) ) > ( java.lang.Integer.MAX_VALUE ) ) { throw new org.ovirt.engine.api.utils.InvalidValueException ( ( ( ( "Value " + value ) + " greater than maximum " ) + ( java.lang.Integer.MAX_VALUE ) ) ) ; } return result.intValue ( ) ; }

Target:
public static long parseUnsignedInt ( java.lang.String value ) { java.math.BigInteger result = javax.xml.bind.DatatypeConverter.parseInteger ( value ) ; if ( ( result.compareTo ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_INT ) ) > 0 ) { throw new org.ovirt.engine.api.utils.InvalidValueException ( ( ( ( "Value " + value ) + " is greater than maximum unsigned integer " ) + ( org.ovirt.engine.api.utils.IntegerParser.MAX_UNSIGNED_INT ) ) ) ; } return result.longValue ( ) ; }
Source:
public void testActivate ( ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( ActionType.HotPlugDiskToVm , org.ovirt.engine.core.common.action.VmDiskOperationParameterBase.class , new java.lang.String [ ] { "DiskVmElement" } , new java.lang.Object [ ] { new org.ovirt.engine.core.common.businessentities.storage.DiskVmElement ( org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.DISK_ID , org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.VM_ID ) } , true , true ) ) ; javax.ws.rs.core.Response response = resource.activate ( new org.ovirt.engine.api.model.Action ( ) ) ; assertEquals ( 200 , response.getStatus ( ) ) ; }

Target:
public void testActivate ( ) throws java.lang.Exception { setUriInfo ( setUpActionExpectations ( ActionType.HotPlugDiskToVm , org.ovirt.engine.core.common.action.VmDiskOperationParameterBase.class , new java.lang.String [ ] { "DiskVmElement" } , new java.lang.Object [ ] { new org.ovirt.engine.core.common.businessentities.storage.DiskVmElement ( org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.DISK_ID , org.ovirt.engine.api.restapi.resource.BackendVmDiskResourceTest.VM_ID ) } , true , true ) ) ; javax.ws.rs.core.Response response = resource.activate ( new org.ovirt.engine.api.model.Action ( ) ) ; org.junit.Assert.assertEquals ( 200 , response.getStatus ( ) ) ; }
Source:
private void VdsExistWithHigherVersion ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setstatus ( VDSStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > vdsList = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > ( ) ; vdsList.add ( vds ) ; org.mockito.Mockito.when ( vdsDAO.getAllForVdsGroup ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vdsList ) ; }

Target:
private void VdsExistWithHigherVersion ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setStatus ( VDSStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VDS > vdsList = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDS > ( ) ; vdsList.add ( vds ) ; org.mockito.Mockito.when ( vdsDAO.getAllForVdsGroup ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( vdsList ) ; }
Source:
public void testEmptyListResponseWithQuery ( ) { java.util.List < org.ovirt.engine.sdk4.types.StorageDomain > storageDomains = storageDomainsService.list ( ) . search ( "name=ugly" ) . send ( ) . storageDomain ( ) ; org.junit.Assert.assertNotNull ( storageDomains ) ; org.junit.Assert.assertEquals ( new java.util.ArrayList < org.ovirt.engine.sdk4.types.StorageDomain > ( ) , storageDomains ) ; }

Target:
public void testEmptyListResponseWithQuery ( ) { java.util.List < org.ovirt.engine.sdk4.types.StorageDomain > storageDomains = storageDomainsService.list ( ) . search ( "name=ugly" ) . send ( ) . storageDomains ( ) ; org.junit.Assert.assertNotNull ( storageDomains ) ; org.junit.Assert.assertEquals ( new java.util.ArrayList < org.ovirt.engine.sdk4.types.StorageDomain > ( ) , storageDomains ) ; }
Source:
private void logImportEvents ( ) { org.ovirt.engine.core.common.businessentities.VmStatic vmStaticFromOvf = getVm ( ) . getStaticData ( ) ; org.ovirt.engine.core.utils.ovf.OvfLogEventHandler < org.ovirt.engine.core.common.businessentities.VmStatic > handler = new org.ovirt.engine.core.utils.ovf.VMStaticOvfLogHandler ( vmStaticFromOvf ) ; java.util.Map < java.lang.String , java.lang.String > aliasesValuesMap = handler.getAliasesValuesMap ( ) ; for ( java.util.Map.Entry < java.lang.String , java.lang.String > entry : aliasesValuesMap.entrySet ( ) ) { java.lang.String fieldName = entry.getKey ( ) ; java.lang.String fieldValue = entry.getValue ( ) ; logField ( vmStaticFromOvf , fieldName , fieldValue ) ; } handler.resetDefaults ( org.ovirt.engine.core.bll.ImportVmCommand.vmStaticForDefaultValues ) ; }

Target:
private void logImportEvents ( ) { org.ovirt.engine.core.common.businessentities.VmStatic vmStaticFromOvf = getVm ( ) . getStaticData ( ) ; org.ovirt.engine.core.utils.ovf.OvfLogEventHandler < org.ovirt.engine.core.common.businessentities.VmStatic > handler = new org.ovirt.engine.core.utils.ovf.VMStaticOvfLogHandler ( vmStaticFromOvf ) ; java.util.Map < java.lang.String , java.lang.String > aliasesValuesMap = handler.getAliasesValuesMap ( ) ; for ( java.util.Map.Entry < java.lang.String , java.lang.String > entry : aliasesValuesMap.entrySet ( ) ) { java.lang.String fieldName = entry.getKey ( ) ; java.lang.String fieldValue = entry.getValue ( ) ; org.ovirt.engine.core.bll.ImportVmCommand.logField ( vmStaticFromOvf , fieldName , fieldValue ) ; } handler.resetDefaults ( org.ovirt.engine.core.bll.ImportVmCommand.vmStaticForDefaultValues ) ; }
Source:
public void run ( ) { log.infoFormat ( "Rollback for command: {0}." , this . getClass ( ) . getName ( ) ) ; try { getAsyncTaskManager ( ) . CancelTasks ( getReturnValue ( ) . getVdsmTaskIdList ( ) ) ; } catch ( java.lang.Exception e ) { log.errorFormat ( "Failed to cancel tasks for command: {0}." , this . getClass ( ) . getName ( ) ) ; } }

Target:
public void run ( ) { log.infoFormat ( "Rollback for command: {0}." , this . getClass ( ) . getName ( ) ) ; try { getAsyncTaskManager ( ) . cancelTasks ( getReturnValue ( ) . getVdsmTaskIdList ( ) ) ; } catch ( java.lang.Exception e ) { log.errorFormat ( "Failed to cancel tasks for command: {0}." , this . getClass ( ) . getName ( ) ) ; } }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { updateWatchdogItems ( ( ( java.util.HashSet < org.ovirt.engine.core.common.businessentities.VmWatchdogType > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { getBehavior ( ) . deactivateInstanceTypeManager ( ) ; updateWatchdogItems ( ( ( java.util.HashSet < org.ovirt.engine.core.common.businessentities.VmWatchdogType > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) ) ; getBehavior ( ) . activateInstanceTypeManager ( ) ; }
Source:
public void vdspysGroupWithVirtGlusterNotSupported ( ) { createCommandWithGlusterEnabled ( ) ; 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 ) ; org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.mcr.mockConfigValue ( ConfigValues.GlusterSupport , org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.VERSION_1_1 , java.lang.Boolean.FALSE ) ; cpuExists ( ) ; allQueriesForVms ( ) ; canDoActionFailedWithReason ( VdcBllMessages.GLUSTER_NOT_SUPPORTED ) ; }

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 ( ) ) ; mcr.mockConfigValue ( ConfigValues.AllowClusterWithVirtGlusterEnabled , java.lang.Boolean.FALSE ) ; mcr.mockConfigValue ( ConfigValues.GlusterSupport , org.ovirt.engine.core.bll.UpdateVdsGroupCommandTest.VERSION_1_1 , java.lang.Boolean.TRUE ) ; cpuExists ( ) ; allQueriesForVms ( ) ; canDoActionFailedWithReason ( VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED ) ; }
Source:
private void OnSavePostNameValidation ( ) { org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel ) ( getWindow ( ) ) ) ; if ( ! ( model.Validate ( ) ) ) { return ; } if ( ( model.getSelectedItem ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel ) { SaveNfsStorage ( ) ; } else if ( ( model.getSelectedItem ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel ) { SaveLocalStorage ( ) ; } else if ( ( model.getSelectedItem ( ) ) instanceof org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel ) { SavePosixStorage ( ) ; } else { SaveSanStorage ( ) ; } }

Target:
private void saveGlusterStorage ( ) { if ( ( getWindow ( ) . getProgress ( ) ) != null ) { return ; } getWindow ( ) . StartProgress ( null ) ; org.ovirt.engine.ui.uicompat.Task.Create ( this , new java.util.ArrayList < java.lang.Object > ( java.util.Arrays.asList ( new java.lang.Object [ ] { "SaveGluster" } ) ) ) . Run ( ) ; }