auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected javax.ws.rs.core.UriInfo setUpActionExpectations ( org.ovirt.engine.core.common.action.VdcActionType task , java.lang.Class < ? extends org.ovirt.engine.core.common.action.VdcActionParametersBase > clz , java.lang.String [ ] names , java.lang.Object [ ] values , boolean canDo , boolean success , java.lang.String errorMessage ) { return setUpActionExpectations ( task , clz , names , values , canDo , success , null , true , errorMessage ) ; }

Target:
protected javax.ws.rs.core.UriInfo setUpActionExpectations ( org.ovirt.engine.core.common.action.VdcActionType task , java.lang.Class < ? extends org.ovirt.engine.core.common.action.VdcActionParametersBase > clz , java.lang.String [ ] names , java.lang.Object [ ] values , boolean valid , boolean success , java.lang.String errorMessage ) { return setUpActionExpectations ( task , clz , names , values , valid , success , null , true , errorMessage ) ; }
Source:
protected void executeVmCommand ( ) { org.ovirt.engine.core.bll.StopVmCommandBase.getParameters ( ) . setEntityId ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getId ( ) ) ; if ( ( ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VMStatus.Suspended ) ) || ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getHibernationVolHandle ( ) ) ) ) ) { setSuspendedVm ( true ) ; org.ovirt.engine.core.bll.StopVmCommandBase.setSucceeded ( stopSuspendedVm ( ) ) ; } else { super . executeVmCommand ( ) ; } }

Target:
protected void executeVmCommand ( ) { org.ovirt.engine.core.bll.StopVmCommandBase.getParameters ( ) . setEntityId ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getId ( ) ) ; if ( ( ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getStatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.VMStatus.Suspended ) ) || ( org.apache.commons.lang.StringUtils.isNotEmpty ( org.ovirt.engine.core.bll.StopVmCommandBase.getVm ( ) . getHibernationVolHandle ( ) ) ) ) { setSuspendedVm ( true ) ; org.ovirt.engine.core.bll.StopVmCommandBase.setSucceeded ( stopSuspendedVm ( ) ) ; } else { super . executeVmCommand ( ) ; } }
Source:
public int getNumOfSnapshotsByMemory ( java.lang.String memoryVolume ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "memory_volume" , getNullableRepresentation ( memoryVolume ) ) ; return getCallsHandler ( ) . executeRead ( "GetNumOfSnapshotsByMemoryVolume" , org.springframework.jdbc.core.SingleColumnRowMapper.newInstance ( java.lang.Integer.class ) , parameterSource ) ; }

Target:
public int getNumOfSnapshotsByDisks ( org.ovirt.engine.core.common.businessentities.Snapshot snapshot ) { org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource ( ) . addValue ( "memory_disk_ids" , createArrayOfUUIDs ( java.util.Arrays.asList ( snapshot.getMemoryDiskId ( ) , snapshot.getMetadataDiskId ( ) ) ) ) ; return getCallsHandler ( ) . executeRead ( "GetNumOfSnapshotsByMemoryVolume" , org.springframework.jdbc.core.SingleColumnRowMapper.newInstance ( java.lang.Integer.class ) , parameterSource ) ; }
Source:
public static org.ovirt.engine.core.common.businessentities.storage.DiskImage createSnapshotMemoryDisk ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType , org.ovirt.engine.core.bll.utils.VmOverheadCalculator vmOverheadCalculator ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage image = org.ovirt.engine.core.bll.memory.MemoryUtils.createMemoryDisk ( vm , storageType , vmOverheadCalculator ) ; image.setDiskAlias ( org.ovirt.engine.core.bll.memory.MemoryUtils.VM_SNAPSHOT_MEMORY_DISK_ALIAS ) ; image.setDescription ( org.ovirt.engine.core.bll.memory.MemoryUtils.VM_SNAPSHOT_MEMORY_DISK_DESCRIPTION ) ; return image ; }

Target:
public static org.ovirt.engine.core.common.businessentities.storage.DiskImage createSnapshotMemoryDisk ( org.ovirt.engine.core.common.businessentities.VM vm , org.ovirt.engine.core.common.businessentities.storage.StorageType storageType , org.ovirt.engine.core.bll.utils.VmOverheadCalculator vmOverheadCalculator , java.lang.String diskDescription ) { org.ovirt.engine.core.common.businessentities.storage.DiskImage image = org.ovirt.engine.core.bll.memory.MemoryUtils.createMemoryDisk ( vm , storageType , vmOverheadCalculator , diskDescription ) ; image.setDiskAlias ( org.ovirt.engine.core.bll.memory.MemoryUtils.VM_SNAPSHOT_MEMORY_DISK_ALIAS ) ; return image ; }
Source:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } for ( org.ovirt.engine.core.common.businessentities.VDS vds : getServersInCluster ( ) ) { if ( ( vds.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VDSStatus.Up ) ) { setVdsName ( vds.getName ( ) ) ; addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP ) ; return false ; } } return true ; }

Target:
protected boolean canDoAction ( ) { if ( ! ( super . canDoAction ( ) ) ) { return false ; } for ( org.ovirt.engine.core.common.businessentities.VDS vds : getServersInCluster ( ) ) { if ( ( vds.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VDSStatus.Up ) ) { setVdsName ( vds.getName ( ) ) ; addCanDoActionMessage ( VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP ) ; addCanDoActionMessage ( java.lang.String.format ( "$%1$s %2$s" , "VdsName" , vds.getName ( ) ) ) ; return false ; } } return true ; }
Source:
public void networkQosNull ( ) { org.mockito.Mockito.when ( vnicProfile.getNetworkQosId ( ) ) . thenReturn ( null ) ; org.junit.Assert.assertThat ( validator.networkQosExistsOrNull ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void networkQosExists ( ) { org.mockito.Mockito.when ( vnicProfile.getNetworkQosId ( ) ) . thenReturn ( org.ovirt.engine.core.bll.validator.VnicProfileValidatorTest.DEFAULT_GUID ) ; org.mockito.Mockito.when ( networkQosDao.get ( org.ovirt.engine.core.bll.validator.VnicProfileValidatorTest.DEFAULT_GUID ) ) . thenReturn ( networkQos ) ; org.hamcrest.MatcherAssert.assertThat ( validator.networkQosExistsOrNull ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getDestinationDiskImage ( ) { if ( ( destinationImage ) == null ) { destinationImage = org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand.getDiskImageDao ( ) . get ( getDestinationImageId ( ) ) ; if ( ( destinationImage ) == null ) { destinationImage = org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand.getDiskImageDao ( ) . getSnapshotById ( getDestinationImageId ( ) ) ; } } return destinationImage ; }

Target:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getDestinationDiskImage ( ) { if ( ( destinationImage ) == null ) { destinationImage = diskImageDao.get ( getDestinationImageId ( ) ) ; if ( ( destinationImage ) == null ) { destinationImage = diskImageDao.getSnapshotById ( getDestinationImageId ( ) ) ; } } return destinationImage ; }
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getDbFacade ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getParameters ( ) . getId ( ) ) ; if ( vds != null ) { vds.setCpuName ( getCpuFlagsManagerHandler ( ) . findMaxServerCpuByFlags ( vds.getCpuFlags ( ) , vds.getVdsGroupCompatibilityVersion ( ) ) ) ; } org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getQueryReturnValue ( ) . setReturnValue ( vds ) ; }

Target:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getDbFacade ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getParameters ( ) . getId ( ) ) ; if ( vds != null ) { vds.setCpuName ( getCpuFlagsManagerHandler ( ) . findMaxServerCpuByFlags ( vds.getCpuFlags ( ) , vds.getClusterCompatibilityVersion ( ) ) ) ; } org.ovirt.engine.core.bll.GetVdsByVdsIdQuery.getQueryReturnValue ( ) . setReturnValue ( vds ) ; }
Source:
private static void getVlanParentInterface ( org.ovirt.engine.core.compat.Guid vdsID , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface , org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetVlanParent , new org.ovirt.engine.core.common.queries.InterfaceAndIdQueryParameters ( vdsID , iface ) , aQuery ) ; }

Target:
public static void getAllProvidersByType ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.common.businessentities.ProviderType providerType ) { 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.Provider > ( ) ; } return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllProviders , new org.ovirt.engine.core.common.queries.GetAllProvidersParameters ( providerType ) , aQuery ) ; }
Source:
private void setupVdsNetworkInterfaceDao ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > expectedVdsNetworkInterface = java.util.Collections.singletonList ( vdsNetworkInterface ) ; org.ovirt.engine.core.dao.network.InterfaceDao vdsNetworkInterfaceDaoMock = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.network.InterfaceDao.class ) ; org.mockito.Mockito.when ( vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId ( networkId ) ) . thenReturn ( expectedVdsNetworkInterface ) ; org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getInterfaceDao ( ) ) . thenReturn ( vdsNetworkInterfaceDaoMock ) ; }

Target:
private void setupVdsDao ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VDS > expectedVds = java.util.Collections.singletonList ( vds ) ; org.mockito.Mockito.when ( vdsDAOMocked.getAllForNetwork ( networkId ) ) . thenReturn ( expectedVds ) ; }
Source:
public void validateIsoPrefix ( ) throws java.lang.Exception { java.lang.String initrd = "initrd" ; java.lang.String kernel = "kernel" ; org.ovirt.engine.core.common.businessentities.VM vm = createVmForTesting ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ISO_PREFIX ) + initrd ) , ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ISO_PREFIX ) + kernel ) ) ; org.junit.Assert.assertEquals ( vm.getinitrd_url ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + initrd ) ) ; org.junit.Assert.assertEquals ( vm.getkernel_url ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + kernel ) ) ; }

Target:
public void validateIsoPrefix ( ) throws java.lang.Exception { java.lang.String initrd = "initrd" ; java.lang.String kernel = "kernel" ; org.ovirt.engine.core.common.businessentities.VM vm = createVmForTesting ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ISO_PREFIX ) + initrd ) , ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ISO_PREFIX ) + kernel ) ) ; org.junit.Assert.assertEquals ( vm.getInitrdUrl ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + initrd ) ) ; org.junit.Assert.assertEquals ( vm.getKernelUrl ( ) , ( ( ( org.ovirt.engine.core.bll.RunVmCommandTest.ACTIVE_ISO_PREFIX ) + "/" ) + kernel ) ) ; }
Source:
public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; org.ovirt.engine.core.common.action.HostSetupNetworksParameters params = new org.ovirt.engine.core.common.action.HostSetupNetworksParameters ( host.getId ( ) ) ; params.setBonds ( java.util.Collections.singletonList ( bond ) ) ; doTestValidateModifiedBondSlaves ( params , null , java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.NetworkAttachment > emptyList ( ) , java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.Network > emptyList ( ) , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.HOST_NETWORK_INTERFACE_NOT_EXIST ) , ValidationResult.VALID , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.HOST_NETWORK_INTERFACE_NOT_EXIST ) ) ; }

Target:
public void testValidateModifiedBondSlavesWhenSlaveIsNotValid ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; org.ovirt.engine.core.common.action.HostSetupNetworksParameters params = new org.ovirt.engine.core.common.action.HostSetupNetworksParameters ( host.getId ( ) ) ; params.setBonds ( java.util.Collections.singletonList ( bond ) ) ; doTestValidateModifiedBondSlaves ( params , null , java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.NetworkAttachment > emptyList ( ) , java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.Network > emptyList ( ) , ValidationResult.VALID , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_BOND_OR_VLAN_CANNOT_BE_SLAVE ) , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_BOND_OR_VLAN_CANNOT_BE_SLAVE ) ) ; }
Source:
public void testGetHostNetworksByCluster ( ) { java.util.Map < org.ovirt.engine.core.compat.Guid , java.util.List < java.lang.String > > map = dao.getHostNetworksByCluster ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.CLUSTER_ID ) ; org.junit.Assert.assertNotNull ( map ) ; org.junit.Assert.assertFalse ( map.isEmpty ( ) ) ; org.junit.Assert.assertNotNull ( map.get ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.VDS_ID ) ) ; org.junit.Assert.assertFalse ( map.get ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.VDS_ID ) . isEmpty ( ) ) ; }

Target:
public void testGetHostNetworksByCluster ( ) { java.util.Map < org.ovirt.engine.core.compat.Guid , java.util.List < java.lang.String > > map = dao.getHostNetworksByCluster ( FixturesTool.CLUSTER ) ; org.junit.Assert.assertNotNull ( map ) ; org.junit.Assert.assertFalse ( map.isEmpty ( ) ) ; org.junit.Assert.assertNotNull ( map.get ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.VDS_ID ) ) ; org.junit.Assert.assertFalse ( map.get ( org.ovirt.engine.core.dao.network.InterfaceDaoImplTest.VDS_ID ) . isEmpty ( ) ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.VDS createHost ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ; vds.setVdsGroupId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_CLUSTER_ID ) ; vds.setVdsName ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.HOST_NAME ) ; vds.setStatus ( VDSStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.pm.FenceAgent > agents = new java.util.LinkedList < > ( ) ; agents.add ( agent1 ) ; agents.add ( agent2 ) ; vds.setFenceAgents ( agents ) ; return vds ; }

Target:
private org.ovirt.engine.core.common.businessentities.VDS createHost ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = new org.ovirt.engine.core.common.businessentities.VDS ( ) ; vds.setId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_ID ) ; vds.setClusterId ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.FENCECD_HOST_CLUSTER_ID ) ; vds.setVdsName ( org.ovirt.engine.core.bll.pm.StartVdsCommandTest.HOST_NAME ) ; vds.setStatus ( VDSStatus.Up ) ; java.util.List < org.ovirt.engine.core.common.businessentities.pm.FenceAgent > agents = new java.util.LinkedList < > ( ) ; agents.add ( agent1 ) ; agents.add ( agent2 ) ; vds.setFenceAgents ( agents ) ; return vds ; }
Source:
public void setup ( ) { mockVds ( ) ; executor = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.pm.FenceAgentExecutor ( vds , new org.ovirt.engine.core.common.businessentities.FencingPolicy ( ) ) ) ; org.mockito.Mockito.doReturn ( resourceManager ) . when ( executor ) . getResourceManager ( ) ; org.mockito.Mockito.doReturn ( proxyLocator ) . when ( executor ) . getProxyLocator ( ) ; org.mockito.Mockito.doReturn ( auditLogDirector ) . when ( executor ) . getAuditLogDirector ( ) ; org.mockito.Mockito.doReturn ( realAgent ) . when ( executor ) . createRealAgent ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ; }

Target:
public void setup ( ) { setUpVds ( ) ; executor = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.pm.FenceAgentExecutor ( vds , new org.ovirt.engine.core.common.businessentities.FencingPolicy ( ) ) ) ; org.mockito.Mockito.doReturn ( resourceManager ) . when ( executor ) . getResourceManager ( ) ; org.mockito.Mockito.doReturn ( proxyLocator ) . when ( executor ) . getProxyLocator ( ) ; org.mockito.Mockito.doReturn ( auditLogDirector ) . when ( executor ) . getAuditLogDirector ( ) ; org.mockito.Mockito.doReturn ( realAgent ) . when ( executor ) . createRealAgent ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ; }
Source:
public void validateSpaceNotWithinThreshold ( ) throws java.lang.Exception { org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > command = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN ) ) . when ( storageDomainValidator ) . isDomainWithinThresholds ( ) ; org.mockito.Mockito.doReturn ( storageDomainValidator ) . when ( command ) . createStorageDomainValidator ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.StorageDomain.class ) ) ; junit.framework.Assert.assertFalse ( command.validateSpaceRequirements ( ) ) ; }

Target:
public void validateSpaceNotWithinThreshold ( ) throws java.lang.Exception { org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > command = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN ) ) . when ( storageDomainValidator ) . isDomainWithinThresholds ( ) ; org.mockito.Mockito.doReturn ( storageDomainValidator ) . when ( command ) . createStorageDomainValidator ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.StorageDomain.class ) ) ; org.junit.Assert.assertFalse ( command.validateSpaceRequirements ( ) ) ; }
Source:
public static org.ovirt.engine.core.aaa.DirectoryUser findPrincipalById ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final java.lang.String id ) { java.util.List < org.ovirt.engine.core.aaa.DirectoryUser > users = org.ovirt.engine.core.aaa.AuthzUtils.findPrincipalsByIds ( extension , java.util.Arrays.asList ( id ) ) ; if ( users.isEmpty ( ) ) { return null ; } return users.get ( 0 ) ; }

Target:
public static org.ovirt.engine.core.aaa.DirectoryUser findPrincipalById ( final org.ovirt.engine.core.extensions.mgr.ExtensionProxy extension , final java.lang.String namespace , final java.lang.String id , final boolean groupsResolving , final boolean groupsResolvingRecursive ) { java.util.List < org.ovirt.engine.core.aaa.DirectoryUser > users = org.ovirt.engine.core.aaa.AuthzUtils.findPrincipalsByIds ( extension , namespace , java.util.Arrays.asList ( id ) , groupsResolving , groupsResolvingRecursive ) ; if ( users.isEmpty ( ) ) { return null ; } return users.get ( 0 ) ; }
Source:
public void testRemoveNonExistant ( ) { setUpEntityQueryExpectations ( java.util.Collections.emptyList ( ) ) ; try { resource.remove ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { org.junit.jupiter.api.Assertions.assertNotNull ( wae.getResponse ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }

Target:
public void testRemoveNonExistant ( ) { setUpEntityQueryExpectations ( java.util.Collections.emptyList ( ) ) ; try { resource.remove ( ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void canDoActionSameSourceAndDest ( ) throws java.lang.Exception { destStorageId = srcStorageId ; initializeCommand ( ImageOperation.Move ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; initSrcStorageDomain ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_SOURCE_AND_TARGET_SAME.toString ( ) ) ) ; }

Target:
public void canDoActionSameSourceAndDest ( ) throws java.lang.Exception { destStorageId = srcStorageId ; initializeCommand ( ImageOperation.Move , new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) ; initVmDiskImage ( false ) ; mockGetVmsListForDisk ( ) ; initSrcStorageDomain ( ) ; org.junit.Assert.assertFalse ( command.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_SOURCE_AND_TARGET_SAME.toString ( ) ) ) ; }
Source:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getUpdateCommand ( ) ) ) { update ( ) ; } else if ( command == ( getLoginAllCommand ( ) ) ) { loginAll ( ) ; } else if ( command == ( getDiscoverTargetsCommand ( ) ) ) { discoverTargets ( ) ; } }

Target:
public void executeCommand ( org.ovirt.engine.ui.uicommonweb.UICommand command ) { super . executeCommand ( command ) ; if ( command == ( getUpdateCommand ( ) ) ) { update ( ) ; } else if ( command == ( getLoginCommand ( ) ) ) { login ( ) ; } else if ( command == ( getDiscoverTargetsCommand ( ) ) ) { discoverTargets ( ) ; } }
Source:
private javax.ws.rs.core.UriInfo setUpUriExpectations ( ) { javax.ws.rs.core.UriInfo uriInfo = org.easymock.EasyMock.createMock ( javax.ws.rs.core.UriInfo.class ) ; org.easymock.EasyMock.expect ( uriInfo.getBaseUri ( ) ) . andReturn ( java.net.URI.create ( ( ( org.ovirt.engine.api.restapi.util.LinkHelperTest.URI_ROOT ) + ( org.ovirt.engine.api.restapi.util.LinkHelperTest.BASE_PATH ) ) ) ) . anyTimes ( ) ; org.easymock.EasyMock.replay ( uriInfo ) ; return uriInfo ; }

Target:
public void setUp ( ) { org.ovirt.engine.api.restapi.invocation.Current current = new org.ovirt.engine.api.restapi.invocation.Current ( ) ; current.setRoot ( org.ovirt.engine.api.restapi.util.LinkHelperTest.URI_ROOT ) ; current.setPrefix ( org.ovirt.engine.api.restapi.util.LinkHelperTest.BASE_PATH ) ; current.setPath ( "" ) ; org.ovirt.engine.api.restapi.invocation.CurrentManager.put ( current ) ; }
Source:
public void testRemove ( ) { org.ovirt.engine.core.common.businessentities.CommandEntity cmd = dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertNotNull ( cmd ) ; dao.remove ( getExistingEntityId ( ) ) ; org.ovirt.engine.core.common.businessentities.CommandEntity cmdAfterRemoval = dao.get ( getExistingEntityId ( ) ) ; org.junit.Assert.assertNull ( cmdAfterRemoval ) ; }

Target:
public void testRemove ( ) { org.ovirt.engine.core.common.businessentities.CommandEntity cmd = dao.get ( getExistingEntityId ( ) ) ; org.junit.jupiter.api.Assertions.assertNotNull ( cmd ) ; dao.remove ( getExistingEntityId ( ) ) ; org.ovirt.engine.core.common.businessentities.CommandEntity cmdAfterRemoval = dao.get ( getExistingEntityId ( ) ) ; org.junit.jupiter.api.Assertions.assertNull ( cmdAfterRemoval ) ; }
Source:
public void getAAANamespaces ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source != null ? ( ( java.util.HashMap < java.lang.String , java.util.List < java.lang.String > > ) ( source ) ) : new java.util.HashMap < java.lang.String , java.util.List < java.lang.String > > ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAvailableNamespaces , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }

Target:
public void getVmDiskList ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid vmId , boolean isRefresh ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source != null ) { return source ; } return new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.DiskImage > ( ) ; } } ; org.ovirt.engine.core.common.queries.IdQueryParameters params = new org.ovirt.engine.core.common.queries.IdQueryParameters ( vmId ) ; params.setRefresh ( isRefresh ) ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetAllDisksByVmId , params , aQuery ) ; }
Source:
protected org.ovirt.engine.api.model.OpenStackNetworkProvider postPopulate ( org.ovirt.engine.api.model.OpenStackNetworkProvider model ) { model.setType ( OpenStackNetworkProviderType.NEUTRON ) ; model.setPluginType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.NetworkPluginType.class ) ) ; org.ovirt.engine.api.model.AgentConfiguration agentConfiguration = model.getAgentConfiguration ( ) ; agentConfiguration.setBrokerType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.MessageBrokerType.class ) ) ; return model ; }

Target:
protected org.ovirt.engine.api.model.OpenStackNetworkProvider postPopulate ( org.ovirt.engine.api.model.OpenStackNetworkProvider model ) { model.setType ( OpenStackNetworkProviderType.NEUTRON ) ; model.setPluginType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.NetworkPluginType.class ) ) ; org.ovirt.engine.api.model.AgentConfiguration agentConfiguration = model.getAgentConfiguration ( ) ; agentConfiguration.setBrokerType ( org.ovirt.engine.api.restapi.types.MappingTestHelper.shuffle ( org.ovirt.engine.api.model.MessageBrokerType.class ) ) ; model.setAutoSync ( true ) ; model.setReadOnly ( false ) ; model.setUnmanaged ( true ) ; return model ; }
Source:
public void canDoActionFailsOnNullCluster ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookStatusChangeParameters ( null , HOOK_ID ) ) ) ; setupMocks ( cmd ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID.toString ( ) ) ) ; }

Target:
public void canDoActionFailsOnNoHook ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd , false ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString ( ) ) ) ; }
Source:
protected void itemsCollectionChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs e ) { super . itemsCollectionChanged ( sender , e ) ; if ( ( ( getSystemTreeSelectedItem ( ) ) != null ) && ( ( getSystemTreeSelectedItem ( ) . getType ( ) ) == ( org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemType.Host ) ) ) { org.ovirt.engine.core.common.businessentities.VDS host = ( ( org.ovirt.engine.core.common.businessentities.VDS ) ( getSystemTreeSelectedItem ( ) . getEntity ( ) ) ) ; setSelectedItem ( org.ovirt.engine.ui.uicommonweb.Linq.FirstOrDefault ( org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.VDS > Cast ( getItems ( ) ) , new org.ovirt.engine.ui.uicommonweb.Linq.HostPredicate ( host.getId ( ) ) ) ) ; } }

Target:
protected void itemsCollectionChanged ( java.lang.Object sender , org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs e ) { super . itemsCollectionChanged ( sender , e ) ; if ( ( ( getSystemTreeSelectedItem ( ) ) != null ) && ( ( getSystemTreeSelectedItem ( ) . getType ( ) ) == ( org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemType.Host ) ) ) { org.ovirt.engine.core.common.businessentities.VDS host = ( ( org.ovirt.engine.core.common.businessentities.VDS ) ( getSystemTreeSelectedItem ( ) . getEntity ( ) ) ) ; setSelectedItem ( org.ovirt.engine.ui.uicommonweb.Linq.firstOrDefault ( org.ovirt.engine.ui.uicommonweb.Linq.< org.ovirt.engine.core.common.businessentities.VDS > cast ( getItems ( ) ) , new org.ovirt.engine.ui.uicommonweb.Linq.HostPredicate ( host.getId ( ) ) ) ) ; } }
Source:
public java.util.List < org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter > getQuotaStorageConsumptionParameters ( ) { java.util.List < org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter > list = new java.util.ArrayList < org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter > ( ) ; for ( org.ovirt.engine.core.common.businessentities.DiskImage disk : org.ovirt.engine.core.bll.AddVmTemplateCommand.getVm ( ) . getDiskList ( ) ) { list.add ( new org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter ( getQuotaIdForDisk ( disk ) , null , QuotaStorageConsumptionParameter.QuotaAction.CONSUME , disk.getStorageIds ( ) . get ( 0 ) , ( ( double ) ( disk.getSizeInGigabytes ( ) ) ) ) ) ; } return list ; }

Target:
public java.util.List < org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter > getQuotaStorageConsumptionParameters ( ) { java.util.List < org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter > list = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.DiskImage disk : org.ovirt.engine.core.bll.AddVmTemplateCommand.getVm ( ) . getDiskList ( ) ) { list.add ( new org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter ( getQuotaIdForDisk ( disk ) , null , QuotaStorageConsumptionParameter.QuotaAction.CONSUME , disk.getStorageIds ( ) . get ( 0 ) , ( ( double ) ( disk.getSizeInGigabytes ( ) ) ) ) ) ; } return list ; }
Source:
public void testNotRemovingUsedPoolRecordIsUsed ( ) throws java.lang.Exception { macPool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; final org.ovirt.engine.core.common.businessentities.StoragePool storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; storagePool.setName ( "storagePool" ) ; org.mockito.Mockito.when ( storagePoolDao.getAllDataCentersByMacPoolId ( macPool.getId ( ) ) ) . thenReturn ( java.util.Collections.singletonList ( storagePool ) ) ; org.junit.Assert.assertThat ( macPoolValidator.notRemovingUsedPool ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_STILL_USED_MAC_POOL ) ) ; }

Target:
public void testNotRemovingUsedPoolRecordIsUsed ( ) throws java.lang.Exception { macPool.setId ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; final org.ovirt.engine.core.common.businessentities.StoragePool storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; storagePool.setName ( "storagePool" ) ; org.mockito.Mockito.when ( storagePoolDao.getAllDataCentersByMacPoolId ( macPool.getId ( ) ) ) . thenReturn ( java.util.Collections.singletonList ( storagePool ) ) ; org.junit.Assert.assertThat ( macPoolValidator.notRemovingUsedPool ( ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_STILL_USED_MAC_POOL ) ) ; }
Source:
public void testDetermineActualFile_Fr ( ) { java.io.File originalFile = org.ovirt.engine.core.utils.ServletUtils.makeFileFromSanePath ( ( "/" + ( java.util.Locale.FRENCH.toLanguageTag ( ) ) ) , testServlet.base ) ; org.mockito.Mockito.when ( mockRequest.getPathInfo ( ) ) . thenReturn ( ( "/" + ( java.util.Locale.FRENCH.toLanguageTag ( ) ) ) ) ; java.io.File actualFile = testServlet.determineActualFile ( mockRequest , java.util.Locale.US ) ; org.junit.Assert.assertNotNull ( "actualFile should not be null" , actualFile ) ; org.junit.Assert.assertTrue ( "actualFile should exist" , actualFile.exists ( ) ) ; org.junit.Assert.assertEquals ( "original and actual should match" , originalFile , actualFile ) ; }

Target:
public void testDetermineActualFile_Fr ( ) { java.io.File originalFile = org.ovirt.engine.core.utils.servlet.ServletUtils.makeFileFromSanePath ( ( "/" + ( java.util.Locale.FRENCH.toLanguageTag ( ) ) ) , testServlet.base ) ; org.mockito.Mockito.when ( mockRequest.getPathInfo ( ) ) . thenReturn ( ( "/" + ( java.util.Locale.FRENCH.toLanguageTag ( ) ) ) ) ; java.io.File actualFile = testServlet.determineActualFile ( mockRequest , java.util.Locale.US ) ; org.junit.Assert.assertNotNull ( "actualFile should not be null" , actualFile ) ; org.junit.Assert.assertTrue ( "actualFile should exist" , actualFile.exists ( ) ) ; org.junit.Assert.assertEquals ( "original and actual should match" , originalFile , actualFile ) ; }
Source:
public boolean isPowerManagementEnabledAndLegal ( org.ovirt.engine.core.common.businessentities.VDS vds , org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup , java.util.List < java.lang.String > messages ) { if ( ! ( ( vds.isPmEnabled ( ) ) && ( isPowerManagementLegal ( vds.getFenceAgents ( ) , vdsGroup , messages ) ) ) ) { messages.add ( VdcBllMessages.VDS_FENCE_DISABLED.name ( ) ) ; return false ; } else { return true ; } }

Target:
public boolean isPowerManagementEnabledAndLegal ( org.ovirt.engine.core.common.businessentities.VDS vds , org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup , java.util.List < java.lang.String > messages ) { if ( ! ( ( vds.isPmEnabled ( ) ) && ( isPowerManagementLegal ( vds.getFenceAgents ( ) , vdsGroup , messages ) ) ) ) { messages.add ( EngineMessage.VDS_FENCE_DISABLED.name ( ) ) ; return false ; } else { return true ; } }
Source:
protected void executeCommand ( ) { addCustomValue ( "NicName" , getNic ( ) . getName ( ) ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase result = runInternalAction ( VdcActionType.PersistentSetupNetworks , new org.ovirt.engine.core.bll.network.RemoveNetworksByLabelParametersBuilder ( org.ovirt.engine.core.bll.network.host.UnlabelNicCommand.getContext ( ) ) . buildParameters ( getNic ( ) , getLabel ( ) , org.ovirt.engine.core.bll.network.host.UnlabelNicCommand.getVds ( ) . getVdsGroupId ( ) ) , org.ovirt.engine.core.bll.network.host.UnlabelNicCommand.cloneContextAndDetachFromParent ( ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { propagateFailure ( result ) ; } setSucceeded ( result.getSucceeded ( ) ) ; }

Target:
protected void executeCommand ( ) { addCustomValue ( "NicName" , getNic ( ) . getName ( ) ) ; org.ovirt.engine.core.common.action.VdcReturnValueBase result = runInternalAction ( VdcActionType.HostSetupNetworks , createHostSetupNetworksParameters ( ) , org.ovirt.engine.core.bll.network.host.UnlabelNicCommand.cloneContextAndDetachFromParent ( ) ) ; if ( ! ( result.getSucceeded ( ) ) ) { propagateFailure ( result ) ; } setSucceeded ( result.getSucceeded ( ) ) ; }
Source:
public void processOnClientIpChange ( final org.ovirt.engine.core.common.businessentities.VDS vds , final org.ovirt.engine.core.compat.Guid vmId ) { final org.ovirt.engine.core.common.businessentities.VmDynamic vmDynamic = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVmDynamicDao ( ) . get ( vmId ) ; if ( org.apache.commons.lang.StringUtils.isEmpty ( vmDynamic.getclient_ip ( ) ) ) { vmDynamic.setConsole_current_user_name ( null ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVmDynamicDao ( ) . update ( vmDynamic ) ; } }

Target:
public void processOnClientIpChange ( final org.ovirt.engine.core.common.businessentities.VDS vds , final org.ovirt.engine.core.compat.Guid vmId ) { final org.ovirt.engine.core.common.businessentities.VmDynamic vmDynamic = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVmDynamicDao ( ) . get ( vmId ) ; if ( org.apache.commons.lang.StringUtils.isEmpty ( vmDynamic.getClientIp ( ) ) ) { vmDynamic.setConsoleCurrentUserName ( null ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVmDynamicDao ( ) . update ( vmDynamic ) ; } }
Source:
public boolean getIsQxlSupported ( ) { boolean isLinux = getIsLinuxOS ( ) ; boolean isQxl = ( getDisplayType ( ) ) == ( org.ovirt.engine.core.common.businessentities.DisplayType.qxl ) ; boolean clusterSupportsSinglePci = ( ( getSelectedCluster ( ) ) != null ) && ( ( Version.v3_3.compareTo ( getSelectedCluster ( ) . getcompatibility_version ( ) ) ) <= 0 ) ; return ( isLinux && isQxl ) && clusterSupportsSinglePci ; }

Target:
public boolean getIsQxlSupported ( ) { boolean isLinux = getIsLinuxOS ( ) ; boolean isQxl = ( getDisplayType ( ) . getSelectedItem ( ) ) == ( org.ovirt.engine.core.common.businessentities.DisplayType.qxl ) ; boolean isSpice = ( getGraphicsType ( ) . getSelectedItem ( ) ) == ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel.GraphicsTypes.SPICE ) ; boolean clusterSupportsSinglePci = ( ( getSelectedCluster ( ) ) != null ) && ( ( Version.v3_3.compareTo ( getSelectedCluster ( ) . getCompatibilityVersion ( ) ) ) <= 0 ) ; return ( ( isLinux && isQxl ) && isSpice ) && clusterSupportsSinglePci ; }
Source:
public void testAddIncompleteParameters ( ) { org.ovirt.engine.api.model.NetworkFilterParameter model = new org.ovirt.engine.api.model.NetworkFilterParameter ( ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; org.junit.jupiter.api.Assertions.fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "NetworkFilterParameter" , "add" , "value" ) ; } }

Target:
public void testSubResourceLocatorBadGuid ( ) { verifyNotFoundException ( org.junit.jupiter.api.Assertions.assertThrows ( javax.ws.rs.WebApplicationException.class , ( ) -> org.ovirt.engine.api.restapi.resource.collection.getParameterResource ( "foo" ) ) ) ; }
Source:
public void testNetworkIpAddressWasSameAsHostnameAndChangedWhenIfaceDoesNotExist ( ) { org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment = createNetworkAttachmentWithIpConfiguration ( Ipv4BootProtocol.STATIC_IP , null , null ) ; attachment.setNicName ( "nicName" ) ; org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator validator = createNetworkAttachmentValidator ( attachment ) ; org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > nics = new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > emptyList ( ) ) ; org.junit.Assert.assertThat ( validator.networkIpAddressWasSameAsHostnameAndChanged ( nics ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void testNetworkIpAddressWasSameAsHostnameAndChangedWhenIfaceDoesNotExist ( ) { org.ovirt.engine.core.common.businessentities.network.NetworkAttachment attachment = createNetworkAttachmentWithIpv4Configuration ( Ipv4BootProtocol.STATIC_IP , null , null ) ; attachment.setNicName ( org.ovirt.engine.core.bll.validator.NetworkAttachmentValidatorTest.NIC_NAME ) ; org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator validator = createNetworkAttachmentValidator ( attachment ) ; org.junit.Assert.assertThat ( validator.networkIpAddressWasSameAsHostnameAndChanged ( org.ovirt.engine.core.bll.validator.NetworkAttachmentValidatorTest.EMPTY_NICS_MAP ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.bll.ValidationResult slavesValidationResult = new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE_ENTITY , "slaveA" ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.VAR_NETWORK_NAME , "networkName" ) ) ; org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; doTestValidModifiedBonds ( bond , ValidationResult.VALID , ValidationResult.VALID , slavesValidationResult , slavesValidationResult ) ; }

Target:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.errors.EngineMessage engineMessage = org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ; org.ovirt.engine.core.bll.ValidationResult slavesValidationResult = new org.ovirt.engine.core.bll.ValidationResult ( engineMessage , org.ovirt.engine.core.utils.ReplacementUtils.getVariableAssignmentString ( engineMessage , "slaveA" ) , org.ovirt.engine.core.utils.ReplacementUtils.createSetVariableString ( HostSetupNetworksValidator.VAR_NETWORK_NAME , "networkName" ) ) ; org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; doTestValidModifiedBonds ( bond , ValidationResult.VALID , slavesValidationResult , slavesValidationResult ) ; }
Source:
public void setThreadsPerCore ( java.lang.String value ) { if ( ( ( threadsPerCore ) == null ) && ( value == null ) ) { return ; } if ( ( ( threadsPerCore ) == null ) || ( ! ( threadsPerCore.equals ( value ) ) ) ) { threadsPerCore = value ; OnPropertyChanged ( new org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ( "ThreadsPerCore" ) ) ; } }

Target:
public void setThreadsPerCore ( java.lang.String value ) { if ( ( ( threadsPerCore ) == null ) && ( value == null ) ) { return ; } if ( ( ( threadsPerCore ) == null ) || ( ! ( threadsPerCore.equals ( value ) ) ) ) { threadsPerCore = value ; onPropertyChanged ( new org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ( "ThreadsPerCore" ) ) ; } }
Source:
public static void initDiskHotpluggableInterfacesMap ( ) { org.ovirt.engine.ui.frontend.AsyncQuery callback = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; callback.asyncCallback = 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.dataprovider.AsyncDataProvider.diskHotpluggableInterfacesMap = ( ( java.util.Map < org.ovirt.engine.core.common.utils.Pair < java.lang.Integer , org.ovirt.engine.core.compat.Version > , java.util.Set < java.lang.String > > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.OsRepository , new org.ovirt.engine.core.common.queries.OsQueryParameters ( org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb.GetDiskHotpluggableInterfacesMap ) , callback ) ; }

Target:
public void initDiskHotpluggableInterfacesMap ( ) { org.ovirt.engine.ui.frontend.AsyncQuery callback = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; callback.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { diskHotpluggableInterfacesMap = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.OsRepository , new org.ovirt.engine.core.common.queries.OsQueryParameters ( org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb.GetDiskHotpluggableInterfacesMap ) , callback ) ; }
Source:
private void updateDirectLunDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { if ( ( getDiskStorageType ( ) . getEntity ( ) ) != ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.LUN ) ) { return ; } boolean isDirectLUNDiskkEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.DirectLUNDiskEnabled , datacenter.getcompatibility_version ( ) . getValue ( ) ) ) ) ; getIsDirectLunDiskAvaialable ( ) . setEntity ( isDirectLUNDiskkEnabled ) ; setMessage ( ( ! isDirectLUNDiskkEnabled ? org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.directLUNDiskNotSupported ( ) : "" ) ) ; }

Target:
private void updateShareableDiskEnabled ( org.ovirt.engine.core.common.businessentities.StoragePool datacenter ) { boolean isShareableDiskEnabled = ( ( java.lang.Boolean ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getConfigValuePreConverted ( ConfigurationValues.ShareableDiskEnabled , datacenter.getCompatibilityVersion ( ) . getValue ( ) ) ) ) ; getIsShareable ( ) . setChangeProhibitionReason ( org.ovirt.engine.ui.uicommonweb.models.vms.AbstractDiskModel.CONSTANTS.shareableDiskNotSupported ( ) ) ; getIsShareable ( ) . setIsChangable ( ( isShareableDiskEnabled && ( isEditEnabled ( ) ) ) ) ; }
Source:
private static < R extends org.ovirt.engine.api.model.BaseResource > void setHref ( javax.ws.rs.core.UriInfo uriInfo , R model , java.lang.Class < ? extends org.ovirt.engine.api.model.BaseResource > suggestedParentType ) { javax.ws.rs.core.UriBuilder uriBuilder = org.ovirt.engine.api.utils.LinkHelper.getUriBuilder ( uriInfo , model , suggestedParentType ) ; if ( uriBuilder != null ) { model.setHref ( uriBuilder.build ( ) . toString ( ) ) ; } }

Target:
private static < R extends org.ovirt.engine.api.model.BaseResource > void setHref ( javax.ws.rs.core.UriInfo uriInfo , R model , java.lang.Class < ? extends org.ovirt.engine.api.model.BaseResource > suggestedParentType ) { javax.ws.rs.core.UriBuilder uriBuilder = org.ovirt.engine.api.restapi.util.LinkHelper.getUriBuilder ( uriInfo , model , suggestedParentType ) ; if ( uriBuilder != null ) { model.setHref ( uriBuilder.build ( ) . toString ( ) ) ; } }
Source:
protected boolean canDoAction ( ) { if ( ( disk ) == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST ) ; } buildSharedLockMap ( ) ; if ( ! ( org.ovirt.engine.core.bll.RemoveDiskCommand.acquireLockInternal ( ) ) ) { return false ; } return ( disk.getDiskStorageType ( ) ) == ( org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType.IMAGE ) ? canRemoveDiskBasedOnImageStorageCheck ( ) : canRemoveLunDisk ( ) ; }

Target:
protected boolean canDoAction ( ) { if ( ( getDisk ( ) ) == null ) { return failCanDoAction ( VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST ) ; } buildSharedLockMap ( ) ; return ( ( org.ovirt.engine.core.bll.RemoveDiskCommand.acquireLockInternal ( ) ) && ( validateAllVmsForDiskAreDown ( ) ) ) && ( canRemoveDiskBasedOnStorageTypeCheck ( ) ) ; }