auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction ( ) { boolean retValue = true ; if ( ( org.ovirt.engine.core.bll.StopVdsCommand.getParameters ( ) . getParentCommand ( ) ) == ( org.ovirt.engine.core.common.action.VdcActionType.Unknown ) ) { retValue = super . canDoAction ( ) ; if ( ( ( org.ovirt.engine.core.bll.StopVdsCommand.getVds ( ) ) != null ) && ( ( org.ovirt.engine.core.bll.StopVdsCommand.getVds ( ) . getstatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VDSStatus.Maintenance ) ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_STOP ) ; retValue = false ; } } return retValue ; }

Target:
protected boolean canDoAction ( ) { boolean retValue = super . canDoAction ( ) ; if ( ( ( org.ovirt.engine.core.bll.StopVdsCommand.getVds ( ) ) != null ) && ( ( org.ovirt.engine.core.bll.StopVdsCommand.getVds ( ) . getstatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VDSStatus.Maintenance ) ) ) { addCanDoActionMessage ( VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_STOP ) ; retValue = false ; } return retValue ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getVdsStaticDao ( ) ) ; dynamicDao = prepareDAO ( dbFacade.getVdsDynamicDao ( ) ) ; statisticsDao = prepareDAO ( dbFacade.getVdsStatisticsDao ( ) ) ; existingVds = dao.get ( FixturesTool.VDS_GLUSTER_SERVER2 ) ; newStaticVds = new org.ovirt.engine.core.common.businessentities.VdsStatic ( ) ; newStaticVds.sethost_name ( "farkle.redhat.com" ) ; newStaticVds.setvds_group_id ( existingVds.getvds_group_id ( ) ) ; newStaticVds.setSSHKeyFingerprint ( "b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31" ) ; newStaticVds.setPmSecondaryOptionsMap ( new org.ovirt.engine.core.common.queries.ValueObjectMap ( ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVdsStaticDao ( ) ; dynamicDao = dbFacade.getVdsDynamicDao ( ) ; statisticsDao = dbFacade.getVdsStatisticsDao ( ) ; existingVds = dao.get ( FixturesTool.VDS_GLUSTER_SERVER2 ) ; newStaticVds = new org.ovirt.engine.core.common.businessentities.VdsStatic ( ) ; newStaticVds.sethost_name ( "farkle.redhat.com" ) ; newStaticVds.setvds_group_id ( existingVds.getvds_group_id ( ) ) ; newStaticVds.setSSHKeyFingerprint ( "b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31" ) ; newStaticVds.setPmSecondaryOptionsMap ( new org.ovirt.engine.core.common.queries.ValueObjectMap ( ) ) ; }
Source:
public void testListWithEveryonePermissions ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpGetEntityExpectations ( VdcQueryType.GetDbUserByUserId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 1 ] } , getUserByIdx ( 1 ) ) ; setUpQueryExpectations ( "" , null , org.ovirt.engine.api.restapi.resource.EVERYONE ) ; collection.setUriInfo ( uriInfo ) ; verifyCollection ( getCollection ( ) ) ; }

Target:
public void testListWithEveryonePermissions ( ) throws java.lang.Exception { javax.ws.rs.core.UriInfo uriInfo = setUpUriExpectations ( null ) ; setUpGetEntityExpectations ( VdcQueryType.GetDbUserByUserId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { GUIDS [ 1 ] } , getUserByIdx ( 1 ) , true ) ; setUpQueryExpectations ( "" , null , org.ovirt.engine.api.restapi.resource.EVERYONE ) ; collection.setUriInfo ( uriInfo ) ; verifyCollection ( getCollection ( ) ) ; }
Source:
public void testPatternBasedNameFails ( ) { mockOsRepository ( ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = createCommand ( initializeMock ( 1 , 1 ) ) ; cmd.getParameters ( ) . getVm ( ) . setName ( "aa-??bb" ) ; org.junit.Assert.assertFalse ( "Pattern-based name should not be supported for VM" , cmd.validateInputs ( ) ) ; }

Target:
public void testPatternBasedNameFails ( ) { org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = createCommand ( initializeMock ( 1 , 1 ) ) ; cmd.getParameters ( ) . getVm ( ) . setName ( "aa-??bb" ) ; org.junit.Assert.assertFalse ( "Pattern-based name should not be supported for VM" , cmd.validateInputs ( ) ) ; }
Source:
public static void isSupportBridgesReportByVDSM ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { 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.lang.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SupportBridgesReportByVDSM ) ; tempVar.setVersion ( version ) ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigFromCache ( tempVar , aQuery ) ; }

Target:
public void isSupportBridgesReportByVDSM ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , java.lang.String version ) { 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.lang.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.core.common.queries.GetConfigurationValueParameters tempVar = new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SupportBridgesReportByVDSM ) ; tempVar.setVersion ( version ) ; getConfigFromCache ( tempVar , aQuery ) ; }
Source:
public boolean validateArchitectures ( ) { final java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmsToImport = getVmsToImport ( ) ; final org.ovirt.engine.core.common.businessentities.StoragePool dataCenter = getDataCenters ( ) . getSelectedItem ( ) ; if ( ( vmsToImport.isEmpty ( ) ) || ( dataCenter == null ) ) { return false ; } return ( validateSameArchitecture ( vmsToImport ) ) && ( validateClusterExistsForArchitecture ( vmsToImport.get ( 0 ) . getClusterArch ( ) , dataCenter ) ) ; }

Target:
public boolean validateArchitectures ( java.util.List < org.ovirt.engine.core.common.businessentities.VM > vmsToImport ) { final org.ovirt.engine.core.common.businessentities.StoragePool dataCenter = getDataCenters ( ) . getSelectedItem ( ) ; if ( ( vmsToImport.isEmpty ( ) ) || ( dataCenter == null ) ) { return false ; } return ( validateSameArchitecture ( vmsToImport ) ) && ( validateClusterExistsForArchitecture ( vmsToImport.get ( 0 ) . getClusterArch ( ) , dataCenter ) ) ; }
Source:
public void testLogReturnLogsWhenLogLevelActiveAndExpandReturn ( ) throws java.lang.Exception { java.lang.String id = "" ; org.slf4j.Logger log = org.mockito.Mockito.mock ( org.slf4j.Logger.class ) ; org.mockito.Mockito.when ( log.isDebugEnabled ( ) ) . thenReturn ( true ) ; org.ovirt.engine.core.utils.log.LoggedUtils.logReturn ( log , id , new org.ovirt.engine.core.utils.log.LoggedUtilsTest.LoggedOverridingSubclass ( ) , new java.lang.Object ( ) ) ; org.mockito.Mockito.verify ( log ) . debug ( org.mockito.ArgumentMatchers.eq ( LoggedUtils.EXIT_LOG_RETURN_VALUE ) , new java.lang.Object [ ] { org.mockito.ArgumentMatchers.anyObject ( ) , org.mockito.ArgumentMatchers.anyObject ( ) , org.mockito.ArgumentMatchers.eq ( id ) } ) ; }

Target:
public void testLogReturnLogsWhenLogLevelActiveAndExpandReturn ( ) throws java.lang.Exception { java.lang.String id = "" ; org.slf4j.Logger log = org.mockito.Mockito.mock ( org.slf4j.Logger.class ) ; org.mockito.Mockito.when ( log.isDebugEnabled ( ) ) . thenReturn ( true ) ; org.ovirt.engine.core.utils.log.LoggedUtils.logReturn ( log , id , new org.ovirt.engine.core.utils.log.LoggedUtilsTest.LoggedOverridingSubclass ( ) , new java.lang.Object ( ) ) ; org.mockito.Mockito.verify ( log ) . debug ( org.mockito.ArgumentMatchers.eq ( LoggedUtils.EXIT_LOG_RETURN_VALUE ) , org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.eq ( id ) ) ; }
Source:
public java.lang.Void runInTransaction ( ) { copyVmDevices ( ) ; addDiskPermissions ( ) ; if ( ( getInstanceType ( ) ) == null ) { addVmPayload ( ) ; updateSmartCardDevices ( ) ; addVmWatchdog ( ) ; addGraphicsDevice ( ) ; } setActionReturnValue ( getVm ( ) . getId ( ) ) ; setSucceeded ( true ) ; return null ; }

Target:
public java.lang.Void runInTransaction ( ) { copyVmDevices ( ) ; addDiskPermissions ( ) ; addVmPayload ( ) ; updateSmartCardDevices ( ) ; addVmWatchdog ( ) ; addGraphicsDevice ( ) ; setActionReturnValue ( getVm ( ) . getId ( ) ) ; setSucceeded ( true ) ; return null ; }
Source:
public void setEntity ( java.lang.Object value ) { cluster = null ; super . setEntity ( value ) ; if ( ( getEntity ( ) ) != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getClusterById ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object listModel , java.lang.Object returnValue ) { cluster = ( ( org.ovirt.engine.core.common.businessentities.VDSGroup ) ( returnValue ) ) ; updateActionAvailability ( ) ; } } ) , ( ( org.ovirt.engine.core.common.businessentities.VmTemplate ) ( getEntity ( ) ) ) . getVdsGroupId ( ) ) ; } }

Target:
public void setEntity ( org.ovirt.engine.core.common.businessentities.VmTemplate value ) { cluster = null ; super . setEntity ( value ) ; if ( ( getEntity ( ) ) != null ) { org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getClusterById ( new org.ovirt.engine.ui.frontend.AsyncQuery ( this , new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object listModel , java.lang.Object returnValue ) { cluster = ( ( org.ovirt.engine.core.common.businessentities.VDSGroup ) ( returnValue ) ) ; updateActionAvailability ( ) ; } } ) , getEntity ( ) . getVdsGroupId ( ) ) ; } }
Source:
private void initSnapshotValidator ( ) { org.mockito.Mockito.when ( snapshotsValidator.vmNotInPreview ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( snapshotsValidator.vmNotDuringSnapshot ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( ValidationResult.VALID ) ; }

Target:
private void initSnapshotValidator ( ) { org.mockito.Mockito.when ( snapshotsValidator.vmNotInPreview ( org.mockito.Matchers.any ( ) ) ) . thenReturn ( ValidationResult.VALID ) ; org.mockito.Mockito.when ( snapshotsValidator.vmNotDuringSnapshot ( org.mockito.Matchers.any ( ) ) ) . thenReturn ( ValidationResult.VALID ) ; }
Source:
public void save ( org.ovirt.engine.core.common.businessentities.Bookmark bookmark ) { org.ovirt.engine.core.compat.Guid id = bookmark.getbookmark_id ( ) ; if ( org.ovirt.engine.core.compat.Guid.isNullOrEmpty ( id ) ) { id = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; bookmark.setbookmark_id ( id ) ; } org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = new org.ovirt.engine.core.dao.BookmarkDaoImpl.BookmarkSqlParameterSource ( bookmark ) ; getCallsHandler ( ) . executeModification ( "InsertBookmark" , parameterSource ) ; }

Target:
public void save ( org.ovirt.engine.core.common.businessentities.Bookmark bookmark ) { org.ovirt.engine.core.compat.Guid id = bookmark.getId ( ) ; if ( org.ovirt.engine.core.compat.Guid.isNullOrEmpty ( id ) ) { id = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; bookmark.setId ( id ) ; } org.springframework.jdbc.core.namedparam.MapSqlParameterSource parameterSource = new org.ovirt.engine.core.dao.BookmarkDaoImpl.BookmarkSqlParameterSource ( bookmark ) ; getCallsHandler ( ) . executeModification ( "InsertBookmark" , parameterSource ) ; }
Source:
public void testExecuteQuery ( ) { java.lang.String vmName = org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getName ( ) ) . thenReturn ( vmName ) ; boolean result = org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextBoolean ( ) ; org.mockito.Mockito.doReturn ( result ) . when ( getQuery ( ) ) . isVmWithSameNameExistStatic ( ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( "Wrong result" , result , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }

Target:
public void testExecuteQuery ( ) { java.lang.String vmName = org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextString ( 10 ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getName ( ) ) . thenReturn ( vmName ) ; boolean result = org.ovirt.engine.core.utils.RandomUtils.instance ( ) . nextBoolean ( ) ; org.mockito.Mockito.doReturn ( result ) . when ( getQuery ( ) ) . isVmWithSameNameExistStatic ( vmName , null ) ; getQuery ( ) . executeQueryCommand ( ) ; org.junit.Assert.assertEquals ( "Wrong result" , result , getQuery ( ) . getQueryReturnValue ( ) . getReturnValue ( ) ) ; }
Source:
public void twoNetworkInterfacesWithDifferentIp ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > listOfInterfaces = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VdsNetworkInterface > ( ) ; listOfInterfaces.add ( createVdsNetworkInterfaceWithStaticIp ( org.ovirt.engine.core.common.validation.NoRepetitiveStaticIpInListConstraintTest.IP_1 ) ) ; listOfInterfaces.add ( createVdsNetworkInterfaceWithStaticIp ( org.ovirt.engine.core.common.validation.NoRepetitiveStaticIpInListConstraintTest.IP_2 ) ) ; validateAndAssertResult ( listOfInterfaces , true ) ; }

Target:
public void twoNetworkInterfacesWithDifferentIp ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > listOfInterfaces = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ( ) ; listOfInterfaces.add ( createVdsNetworkInterfaceWithStaticIp ( org.ovirt.engine.core.common.validation.NoRepetitiveStaticIpInListConstraintTest.IP_1 ) ) ; listOfInterfaces.add ( createVdsNetworkInterfaceWithStaticIp ( org.ovirt.engine.core.common.validation.NoRepetitiveStaticIpInListConstraintTest.IP_2 ) ) ; validateAndAssertResult ( listOfInterfaces , true ) ; }
Source:
private < T extends java.lang.Object > java.util.Set < javax.validation.ConstraintViolation < T > > validate ( T object ) { java.util.Set < javax.validation.ConstraintViolation < T > > validate = validator.validate ( object ) ; for ( javax.validation.ConstraintViolation < T > violation : validate ) { java.lang.System.out.println ( violation.getMessage ( ) ) ; } return validate ; }

Target:
private < T extends java.lang.Object > java.util.Set < javax.validation.ConstraintViolation < T > > validate ( T object ) { return validator.validate ( object ) ; }
Source:
public void diskSnapshotsCannotBePreviewed ( ) { org.ovirt.engine.core.common.businessentities.Snapshot activeSnapshot = getActiveSnapshot ( ) ; org.mockito.Mockito.when ( snapshotDao.get ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( activeSnapshot ) ; org.mockito.Mockito.when ( diskImageDao.get ( disk1.getImageId ( ) ) ) . thenReturn ( disk1 ) ; org.mockito.Mockito.when ( diskImageDao.get ( disk2.getImageId ( ) ) ) . thenReturn ( disk2 ) ; org.junit.Assert.assertThat ( validator.canDiskSnapshotsBePreviewed ( activeSnapshot.getId ( ) ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.CANNOT_PREVIEW_ACTIVE_SNAPSHOT ) ) ; }

Target:
public void diskSnapshotsCannotBePreviewed ( ) { org.ovirt.engine.core.common.businessentities.Snapshot activeSnapshot = getActiveSnapshot ( ) ; org.mockito.Mockito.when ( snapshotDao.get ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( activeSnapshot ) ; org.mockito.Mockito.when ( diskImageDao.get ( disk1.getImageId ( ) ) ) . thenReturn ( disk1 ) ; org.mockito.Mockito.when ( diskImageDao.get ( disk2.getImageId ( ) ) ) . thenReturn ( disk2 ) ; org.junit.Assert.assertThat ( validator.canDiskSnapshotsBePreviewed ( activeSnapshot.getId ( ) ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.CANNOT_PREVIEW_ACTIVE_SNAPSHOT ) ) ; }
Source:
public void unsupportedHostedEngineDeployWhenNoHostedEngine ( ) { org.mockito.Mockito.when ( hostedEngineHelper.isVmManaged ( ) ) . thenReturn ( false ) ; mockCluster ( Version.v4_0 ) ; org.mockito.Mockito.when ( host.getClusterId ( ) ) . thenReturn ( Guid.Empty ) ; org.junit.Assert.assertThat ( validator.supportsDeployingHostedEngine ( new org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration ( HostedEngineDeployConfiguration.Action.DEPLOY ) ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_UNMANAGED_HOSTED_ENGINE ) ) ; }

Target:
public void unsupportedHostedEngineDeployWhenNoHostedEngine ( ) { org.mockito.Mockito.when ( hostedEngineHelper.isVmManaged ( ) ) . thenReturn ( false ) ; org.junit.Assert.assertThat ( validator.supportsDeployingHostedEngine ( new org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration ( HostedEngineDeployConfiguration.Action.DEPLOY ) ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_UNMANAGED_HOSTED_ENGINE ) ) ; }
Source:
public void testAddLunDisk_MissingId ( ) { org.ovirt.engine.api.model.Disk model = createIscsiLunDisk ( ) ; model.getLunStorage ( ) . getLogicalUnits ( ) . get ( 0 ) . setId ( null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "LogicalUnit" , "testAddLunDisk_MissingId" , "id" ) ; } }

Target:
public void testAddLunDisk_MissingId ( ) { org.ovirt.engine.api.model.Disk model = createIscsiLunDisk ( ) ; model.getLunStorage ( ) . getLogicalUnits ( ) . getLogicalUnits ( ) . get ( 0 ) . setId ( null ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "LogicalUnit" , "testAddLunDisk_MissingId" , "id" ) ; } }
Source:
public void commandFailsNoPubKeys ( ) { java.util.List < java.lang.String > pubKeys = new java.util.ArrayList < > ( ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.UpdateGlusterHostPubKeyToSlaveInternalCommand ( new org.ovirt.engine.core.common.action.gluster.UpdateGlusterHostPubKeyToSlaveParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , pubKeys ) ) ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }

Target:
public void commandFailsNoPubKeys ( ) { java.util.List < java.lang.String > pubKeys = new java.util.ArrayList < > ( ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.UpdateGlusterHostPubKeyToSlaveInternalCommand ( new org.ovirt.engine.core.common.action.gluster.UpdateGlusterHostPubKeyToSlaveParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , pubKeys ) , null ) ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getUpServer ( ) ; org.junit.Assert.assertFalse ( command.validate ( ) ) ; }
Source:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 , 0 , false ) ; control.replay ( ) ; org.ovirt.engine.api.model.VnicProfile model = org.ovirt.engine.api.restapi.resource.BackendVnicProfileResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { org.ovirt.engine.api.restapi.resource.BackendVnicProfileResource resource = ( ( org.ovirt.engine.api.restapi.resource.BackendVnicProfileResource ) ( this . resource ) ) ; resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }

Target:
public void testConflictedUpdate ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 , 0 , false ) ; org.ovirt.engine.api.model.VnicProfile model = org.ovirt.engine.api.restapi.resource.BackendVnicProfileResourceTest.getModel ( 1 ) ; model.setId ( GUIDS [ 1 ] . toString ( ) ) ; try { org.ovirt.engine.api.restapi.resource.BackendVnicProfileResource resource = ( ( org.ovirt.engine.api.restapi.resource.BackendVnicProfileResource ) ( this . resource ) ) ; resource.update ( model ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyImmutabilityConstraint ( wae ) ; } }
Source:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getVolumeInfo ( org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.compat.Guid newStorageDomainID , org.ovirt.engine.core.compat.Guid newImageGroupId , org.ovirt.engine.core.compat.Guid newImageId ) { if ( isDataOperationsBySpm ( loadStorageDomainStaticData ( newStorageDomainID ) ) ) { return ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( runVdsCommand ( VDSCommandType.GetImageInfo , new org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters ( storagePoolId , newStorageDomainID , newImageGroupId , newImageId ) ) . getReturnValue ( ) ) ) ; } else { return org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler.getVolumeInfoFromVdsm ( storagePoolId , newStorageDomainID , newImageGroupId , newImageId ) ; } }

Target:
protected org.ovirt.engine.core.common.businessentities.storage.DiskImage getVolumeInfo ( org.ovirt.engine.core.compat.Guid storagePoolId , org.ovirt.engine.core.compat.Guid newStorageDomainID , org.ovirt.engine.core.compat.Guid newImageGroupId , org.ovirt.engine.core.compat.Guid newImageId ) { return ( ( org.ovirt.engine.core.common.businessentities.storage.DiskImage ) ( runVdsCommand ( VDSCommandType.GetImageInfo , new org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters ( storagePoolId , newStorageDomainID , newImageGroupId , newImageId ) ) . getReturnValue ( ) ) ) ; }
Source:
public void onSuccess ( 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 ( ) ; }

Target:
public void onSuccess ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue ) { getBehavior ( ) . deactivateInstanceTypeManager ( ) ; updateWatchdogItems ( ( ( java.util.HashSet < org.ovirt.engine.core.common.businessentities.VmWatchdogType > ) ( returnValue.getReturnValue ( ) ) ) ) ; getBehavior ( ) . activateInstanceTypeManager ( ) ; }
Source:
public void testDedicatedHostNotExistOrNotSameCluster ( ) { prepareVmToPassValidate ( ) ; org.mockito.Mockito.doReturn ( vdsDao ) . when ( command ) . getVdsDao ( ) ; org.mockito.Mockito.doReturn ( false ) . when ( command ) . isDedicatedVdsExistOnSameCluster ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VmBase.class ) , org.mockito.Matchers.any ( java.util.ArrayList.class ) ) ; vmStatic.setDedicatedVmForVdsList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.junit.Assert.assertFalse ( "validate should have failed with invalid dedicated host." , command.validate ( ) ) ; }

Target:
public void testDedicatedHostNotExistOrNotSameCluster ( ) { prepareVmToPassValidate ( ) ; org.mockito.Mockito.doReturn ( false ) . when ( command ) . isDedicatedVdsExistOnSameCluster ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VmBase.class ) , org.mockito.Matchers.any ( java.util.ArrayList.class ) ) ; vmStatic.setDedicatedVmForVdsList ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) ; org.junit.Assert.assertFalse ( "validate should have failed with invalid dedicated host." , command.validate ( ) ) ; }
Source:
private static java.util.Map < java.lang.String , java.lang.Object > getUsbControllerSpecParams ( java.lang.String model , int controllerNumber , int index ) { java.util.Map < java.lang.String , java.lang.Object > specParams = new java.util.HashMap < java.lang.String , java.lang.Object > ( ) ; specParams.put ( VdsProperties.Model , ( model + controllerNumber ) ) ; specParams.put ( VdsProperties.Index , java.lang.Integer.toString ( index ) ) ; return specParams ; }

Target:
private static java.util.Map < java.lang.String , java.lang.Object > getUsbControllerSpecParams ( java.lang.String model , int controllerNumber , int index ) { java.util.Map < java.lang.String , java.lang.Object > specParams = new java.util.HashMap < > ( ) ; specParams.put ( VdsProperties.Model , ( model + controllerNumber ) ) ; specParams.put ( VdsProperties.Index , java.lang.Integer.toString ( index ) ) ; return specParams ; }
Source:
protected org.ovirt.engine.core.common.businessentities.VM getVmEntity ( ) { org.ovirt.engine.api.restapi.resource.VM entity = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.VM.class ) ; org.mockito.Mockito.when ( entity.getId ( ) ) . thenReturn ( GUIDS [ 0 ] ) ; org.mockito.Mockito.when ( entity.getStaticData ( ) ) . thenReturn ( new org.ovirt.engine.core.common.businessentities.VmStatic ( ) ) ; org.mockito.Mockito.when ( entity.getDedicatedVmForVdsList ( ) ) . thenReturn ( java.util.Collections.emptyList ( ) ) ; return entity ; }

Target:
protected org.ovirt.engine.core.common.businessentities.VM getVmEntity ( ) { org.ovirt.engine.api.restapi.resource.VM entity = org.mockito.Mockito.mock ( org.ovirt.engine.core.common.businessentities.VM.class ) ; org.mockito.Mockito.when ( entity.getId ( ) ) . thenReturn ( GUIDS [ 0 ] ) ; org.mockito.Mockito.when ( entity.getStaticData ( ) ) . thenReturn ( new org.ovirt.engine.core.common.businessentities.VmStatic ( ) ) ; return entity ; }
Source:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetVdsHooksByIdQuery.getParameters ( ) . getVdsId ( ) ) ; java.util.Map < java.lang.String , java.lang.Object > result = new java.util.HashMap < java.lang.String , java.lang.Object > ( ) ; if ( vds != null ) { result = org.ovirt.engine.core.utils.vdshooks.VdsHooksParser.parseHooks ( vds.getHooksStr ( ) ) ; } org.ovirt.engine.core.bll.GetVdsHooksByIdQuery.getQueryReturnValue ( ) . setReturnValue ( result ) ; }

Target:
protected void executeQueryCommand ( ) { org.ovirt.engine.core.common.businessentities.VDS vds = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsDao ( ) . get ( org.ovirt.engine.core.bll.GetVdsHooksByIdQuery.getParameters ( ) . getId ( ) ) ; java.util.Map < java.lang.String , java.lang.Object > result = new java.util.HashMap < java.lang.String , java.lang.Object > ( ) ; if ( vds != null ) { result = org.ovirt.engine.core.utils.vdshooks.VdsHooksParser.parseHooks ( vds.getHooksStr ( ) ) ; } org.ovirt.engine.core.bll.GetVdsHooksByIdQuery.getQueryReturnValue ( ) . setReturnValue ( result ) ; }
Source:
private void prepareInterfaceMocks ( org.ovirt.engine.core.bll.gluster.AddBricksToGlusterVolumeCommand command ) { org.mockito.Mockito.doReturn ( getNetworks ( ) ) . when ( networkDao ) . getAllForCluster ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( getNetworkInterfaces ( ) ) . when ( interfaceDao ) . getAllInterfacesForVds ( serverId ) ; }

Target:
private void prepareInterfaceMocks ( ) { org.mockito.Mockito.doReturn ( getNetworks ( ) ) . when ( networkDao ) . getAllForCluster ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.mockito.Mockito.doReturn ( getNetworkInterfaces ( ) ) . when ( interfaceDao ) . getAllInterfacesForVds ( serverId ) ; }
Source:
public void testGetEntityPermissionsByUserAndGroups ( ) { org.junit.Assert.assertNotNull ( dbFacade.getEntityPermissionsForUserAndGroups ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , org.ovirt.engine.core.dao.DbFacadeDAOTest.DIRECTORY_ELEMENT_ID_WITH_BASIC_PERMISSIONS.toString ( ) , ActionGroup.VM_BASIC_OPERATIONS , org.ovirt.engine.core.dao.DbFacadeDAOTest.VMT_ID , VdcObjectType.VM ) ) ; org.junit.Assert.assertNull ( dbFacade.getEntityPermissionsForUserAndGroups ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , org.ovirt.engine.core.dao.DbFacadeDAOTest.DIRECTORY_ELEMENT_ID_WITH_BASIC_PERMISSIONS.toString ( ) , ActionGroup.CREATE_TEMPLATE , org.ovirt.engine.core.dao.DbFacadeDAOTest.VMT_ID , VdcObjectType.VM ) ) ; }

Target:
public void testGetEntityPermissionsByUserAndGroups ( ) { org.junit.Assert.assertNotNull ( dbFacade.getEntityPermissionsForUserAndGroups ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , org.ovirt.engine.core.dao.DbFacadeDAOTest.DIRECTORY_ELEMENT_ID_WITH_BASIC_PERMISSIONS.toString ( ) , ActionGroup.VM_BASIC_OPERATIONS , org.ovirt.engine.core.dao.DbFacadeDAOTest.VMT_ID , VdcObjectType.VM , false ) ) ; org.junit.Assert.assertNull ( dbFacade.getEntityPermissionsForUserAndGroups ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) , org.ovirt.engine.core.dao.DbFacadeDAOTest.DIRECTORY_ELEMENT_ID_WITH_BASIC_PERMISSIONS.toString ( ) , ActionGroup.CREATE_TEMPLATE , org.ovirt.engine.core.dao.DbFacadeDAOTest.VMT_ID , VdcObjectType.VM , false ) ) ; }
Source:
protected org.ovirt.engine.api.model.Network getClusterNetwork ( org.ovirt.engine.core.compat.Guid clusterId , org.ovirt.engine.core.compat.Guid id , java.lang.String name ) { for ( org.ovirt.engine.api.model.Network entity : getBackendCollection ( org.ovirt.engine.api.model.Network.class , VdcQueryType.GetAllNetworksByClusterId , new org.ovirt.engine.core.common.queries.VdsGroupQueryParamenters ( clusterId ) ) ) { if ( ( ( id != null ) && ( id.equals ( entity.getId ( ) ) ) ) || ( ( name != null ) && ( name.equals ( entity.getname ( ) ) ) ) ) { return entity ; } } return null ; }

Target:
protected org.ovirt.engine.api.model.Network getClusterNetwork ( org.ovirt.engine.core.compat.Guid clusterId , org.ovirt.engine.core.compat.Guid id , java.lang.String name ) { for ( org.ovirt.engine.api.model.Network entity : getBackendCollection ( org.ovirt.engine.api.model.Network.class , VdcQueryType.GetAllNetworksByClusterId , new org.ovirt.engine.core.common.queries.VdsGroupQueryParamenters ( clusterId ) ) ) { if ( ( ( id != null ) && ( id.equals ( entity.getId ( ) ) ) ) || ( ( name != null ) && ( name.equals ( entity.getName ( ) ) ) ) ) { return entity ; } } return null ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.VmDevice rngDevice = getRngDevices ( ) . get ( 0 ) ; rngDevice.setSpecParams ( getParameters ( ) . getRngDevice ( ) . generateSpecParams ( ) ) ; getDbFacade ( ) . getVmDeviceDao ( ) . update ( rngDevice ) ; setSucceeded ( true ) ; }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.VmDevice rngDevice = getParameters ( ) . getRngDevice ( ) ; getDbFacade ( ) . getVmDeviceDao ( ) . update ( rngDevice ) ; setSucceeded ( true ) ; }
Source:
private void doTestGetNotFound ( java.lang.String id ) throws java.lang.Exception { org.ovirt.engine.api.restapi.resource.BackendPermitResource resource = new org.ovirt.engine.api.restapi.resource.BackendPermitResource ( id , new org.ovirt.engine.api.restapi.resource.BackendPermitsResource ( org.ovirt.engine.api.restapi.resource.BackendPermitResourceTest.ROLE_ID ) ) ; resource.getParent ( ) . setMappingLocator ( mapperLocator ) ; try { control.replay ( ) ; resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }

Target:
private void doTestGetNotFound ( java.lang.String id ) throws java.lang.Exception { org.ovirt.engine.api.restapi.resource.BackendPermitResource resource = new org.ovirt.engine.api.restapi.resource.BackendPermitResource ( id , new org.ovirt.engine.api.restapi.resource.BackendPermitsResource ( org.ovirt.engine.api.restapi.resource.BackendPermitResourceTest.ROLE_ID ) ) ; resource.getParent ( ) . setMappingLocator ( mapperLocator ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { assertEquals ( 404 , wae.getResponse ( ) . getStatus ( ) ) ; } }
Source:
private void mockHostDevices ( java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > extraDevices ) { java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > devices = new java.util.ArrayList < > ( ) ; devices.add ( pciDevice ) ; devices.add ( netDevice ) ; devices.addAll ( extraDevices ) ; org.mockito.Mockito.when ( hostDeviceDao.getHostDevicesByHostId ( org.ovirt.engine.core.bll.network.host.HostNicVfsConfigHelperImplTest.HOST_ID ) ) . thenReturn ( devices ) ; org.mockito.Mockito.when ( hostDeviceDao.getAll ( ) ) . thenReturn ( devices ) ; }

Target:
private void mockHostDevices ( java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > extraDevices ) { java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > devices = new java.util.ArrayList < > ( ) ; devices.add ( pciDevice ) ; devices.add ( netDevice ) ; devices.addAll ( extraDevices ) ; org.mockito.Mockito.when ( hostDeviceDao.getHostDevicesByHostId ( org.ovirt.engine.core.bll.network.host.HostNicVfsConfigHelperImplTest.HOST_ID ) ) . thenReturn ( devices ) ; }
Source:
private org.ovirt.engine.core.compat.Guid createTask ( org.ovirt.engine.core.compat.Guid taskId , org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsReturnValue , org.ovirt.engine.core.compat.Guid storageDomainId ) { java.lang.String message = org.ovirt.engine.core.dal.job.ExecutionMessageDirector.resolveStepMessage ( StepEnum.MERGE_SNAPSHOTS , getJobMessageProperties ( ) ) ; return super . createTask ( taskId , vdsReturnValue.getCreationInfo ( ) , org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskCommand.getParameters ( ) . getParentCommand ( ) , message , VdcObjectType.Storage , storageDomainId ) ; }

Target:
protected org.ovirt.engine.core.compat.Guid createTask ( org.ovirt.engine.core.compat.Guid taskId , org.ovirt.engine.core.common.vdscommands.VDSReturnValue vdsReturnValue , org.ovirt.engine.core.compat.Guid storageDomainId ) { java.lang.String message = org.ovirt.engine.core.dal.job.ExecutionMessageDirector.resolveStepMessage ( StepEnum.MERGE_SNAPSHOTS , org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskCommand.getJobMessageProperties ( ) ) ; return super . createTask ( taskId , vdsReturnValue.getCreationInfo ( ) , org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskCommand.getParameters ( ) . getParentCommand ( ) , message , VdcObjectType.Storage , storageDomainId ) ; }
Source:
public com.google.gwt.event.dom.client.HasClickHandlers addRebootButton ( ) { org.ovirt.engine.ui.userportal.widget.basic.MainTabBasicListItemActionButton button = new org.ovirt.engine.ui.userportal.widget.basic.MainTabBasicListItemActionButton ( com.google.gwt.safehtml.shared.SafeHtmlUtils.fromSafeConstant ( org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.constants.rebootVm ( ) ) , org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.resources.rebootIcon ( ) , org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.resources.rebootDisabledIcon ( ) , style.rebootButtonAdditionalStyle ( ) ) ; this . rebootButton = button ; addButtonToPanel ( button ) ; return button ; }

Target:
public com.google.gwt.event.dom.client.HasClickHandlers addRebootButton ( ) { org.ovirt.engine.ui.userportal.widget.basic.MainTabBasicListItemActionButton button = new org.ovirt.engine.ui.userportal.widget.basic.MainTabBasicListItemActionButton ( org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.constants.rebootVm ( ) , org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.resources.rebootIcon ( ) , org.ovirt.engine.ui.userportal.section.main.view.tab.basic.MainTabBasicListItemView.resources.rebootDisabledIcon ( ) , style.rebootButtonAdditionalStyle ( ) ) ; this . rebootButton = button ; addButtonToPanel ( button ) ; return button ; }
Source:
private void setDiskImportData ( org.ovirt.engine.core.compat.Guid diskId , java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_domains > storageDomains , org.ovirt.engine.core.common.businessentities.VolumeType volumeType ) { org.ovirt.engine.ui.uicommonweb.models.vms.ImportData data = new org.ovirt.engine.ui.uicommonweb.models.vms.ImportData ( ) ; diskImportDataMap.put ( diskId , data ) ; data.setAllStorageDomains ( filteredStorageDomains ) ; data.setCollapseSnapshot ( getCollapseSnapshots ( ) ) ; data.setStorageDomains ( storageDomains ) ; data.setVolumeType ( volumeType ) ; data.setStorageQuotaList ( storageQuotaMap ) ; }

Target:
protected void setDiskImportData ( org.ovirt.engine.core.compat.Guid diskId , java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_domains > storageDomains , org.ovirt.engine.core.common.businessentities.VolumeType volumeType ) { org.ovirt.engine.ui.uicommonweb.models.vms.ImportData data = new org.ovirt.engine.ui.uicommonweb.models.vms.ImportData ( ) ; diskImportDataMap.put ( diskId , data ) ; data.setAllStorageDomains ( filteredStorageDomains ) ; data.setCollapseSnapshot ( getCollapseSnapshots ( ) ) ; data.setStorageDomains ( storageDomains ) ; data.setVolumeType ( volumeType ) ; data.setStorageQuotaList ( storageQuotaMap ) ; }
Source:
public void testConnectionWithValidMountOptionsSucceeds ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections newPosixConnection = createPosixConnection ( "multipass.my.domain.tlv.company.com:/export/allstorage/data1" , StorageType.NFS , "nfs" , "timeo=30" ) ; parameters.setStorageServerConnection ( newPosixConnection ) ; parameters.setVdsId ( Guid.Empty ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( getCommand ( ) ) . validateMountOptions ( ) ; org.mockito.Mockito.when ( getCommand ( ) . getStorageConnDao ( ) . get ( newPosixConnection.getid ( ) ) ) . thenReturn ( newPosixConnection ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( getCommand ( ) ) ; }

Target:
public void testConnectionWithValidMountOptionsSucceeds ( ) { org.ovirt.engine.core.common.businessentities.StorageServerConnections newPosixConnection = createPosixConnection ( "multipass.my.domain.tlv.company.com:/export/allstorage/data1" , StorageType.NFS , "nfs" , "timeo=30" ) ; parameters.setStorageServerConnection ( newPosixConnection ) ; parameters.setVdsId ( Guid.Empty ) ; org.mockito.Mockito.doReturn ( ValidationResult.VALID ) . when ( getCommand ( ) ) . validateMountOptions ( ) ; org.mockito.Mockito.when ( getCommand ( ) . getStorageConnDao ( ) . get ( newPosixConnection.getId ( ) ) ) . thenReturn ( newPosixConnection ) ; org.ovirt.engine.core.bll.CanDoActionTestUtils.runAndAssertCanDoActionSuccess ( getCommand ( ) ) ; }
Source:
public void init ( ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Initializing Scheduling manager" ) ; loadPolicyUnits ( ) ; loadClusterPolicies ( ) ; org.ovirt.engine.core.bll.scheduling.external.ExternalSchedulerDiscoveryThread discoveryThread = new org.ovirt.engine.core.bll.scheduling.external.ExternalSchedulerDiscoveryThread ( ) ; if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > GetValue ( ConfigValues.ExternalSchedulerEnabled ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Starting external scheduler dicovery thread" ) ; discoveryThread.start ( ) ; } else { discoveryThread.markAllExternalPoliciesAsDisabled ( ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "External scheduler disabled, discovery skipped" ) ; } org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Initialized Scheduling manager" ) ; }

Target:
public void init ( ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Initializing Scheduling manager" ) ; loadPolicyUnits ( ) ; loadClusterPolicies ( ) ; org.ovirt.engine.core.bll.scheduling.external.ExternalSchedulerDiscoveryThread discoveryThread = new org.ovirt.engine.core.bll.scheduling.external.ExternalSchedulerDiscoveryThread ( ) ; if ( org.ovirt.engine.core.common.config.Config.< java.lang.Boolean > getValue ( ConfigValues.ExternalSchedulerEnabled ) ) { org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Starting external scheduler dicovery thread" ) ; discoveryThread.start ( ) ; } else { discoveryThread.markAllExternalPoliciesAsDisabled ( ) ; org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "External scheduler disabled, discovery skipped" ) ; } org.ovirt.engine.core.bll.scheduling.SchedulingManager.log.info ( "Initialized Scheduling manager" ) ; }
Source:
protected java.util.Set < java.lang.String > getExcludeUsers ( ) { java.util.Set < java.lang.String > excludeUsers = new java.util.HashSet < java.lang.String > ( ) ; if ( ( getExcludeItems ( ) ) != null ) { for ( org.ovirt.engine.core.common.businessentities.aaa.DbUser item : getExcludeItems ( ) ) { org.ovirt.engine.core.common.businessentities.aaa.DbUser a = item ; excludeUsers.add ( a.getExternalId ( ) ) ; } } return excludeUsers ; }

Target:
protected java.util.Set < java.lang.String > getExcludeUsers ( ) { java.util.Set < java.lang.String > excludeUsers = new java.util.HashSet < java.lang.String > ( ) ; if ( ( getExcludeItems ( ) ) != null ) { for ( org.ovirt.engine.core.common.businessentities.aaa.DbUser item : getExcludeItems ( ) ) { excludeUsers.add ( item.getExternalId ( ) ) ; } } return excludeUsers ; }
Source:
public java.util.List < java.lang.String > findViolatedNics ( java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypesMap ) { java.util.List < java.lang.String > violatedNics = new java.util.ArrayList < > ( ) ; for ( java.util.Map.Entry < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypes : nicNameToNetworkTypesMap.entrySet ( ) ) { java.lang.String nicName = nicNameToNetworkTypes.getKey ( ) ; java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > networkTypes = nicNameToNetworkTypes.getValue ( ) ; if ( ! ( validateNetworkTypesOnNic ( networkTypes ) ) ) { violatedNics.add ( nicName ) ; } } return violatedNics ; }

Target:
private java.util.List < java.lang.String > findViolatedNics ( java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypesMap ) { java.util.List < java.lang.String > violatedNics = new java.util.ArrayList < > ( ) ; for ( java.util.Map.Entry < java.lang.String , java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > > nicNameToNetworkTypes : nicNameToNetworkTypesMap.entrySet ( ) ) { java.lang.String nicName = nicNameToNetworkTypes.getKey ( ) ; java.util.List < org.ovirt.engine.core.bll.validator.NetworkAttachmentsValidator.NetworkType > networkTypes = nicNameToNetworkTypes.getValue ( ) ; if ( ! ( validateNetworkTypesOnNic ( networkTypes ) ) ) { violatedNics.add ( nicName ) ; } } return violatedNics ; }
Source:
protected void setVirtioScsiController ( org.ovirt.engine.api.model.VM model ) { if ( ! ( model.isSetVirtioScsi ( ) ) ) { model.setVirtioScsi ( new org.ovirt.engine.api.model.VirtIOSCSI ( ) ) ; } model.getVirtioScsi ( ) . setEnabled ( ( ! ( org.ovirt.engine.api.restapi.util.VmHelper.getInstance ( ) . getVirtioScsiControllersForEntity ( new org.ovirt.engine.core.compat.Guid ( model.getId ( ) ) ) . isEmpty ( ) ) ) ) ; }

Target:
protected void setVirtioScsiController ( org.ovirt.engine.api.model.VM model ) { if ( ! ( model.isSetVirtioScsi ( ) ) ) { model.setVirtioScsi ( new org.ovirt.engine.api.model.VirtIOSCSI ( ) ) ; } model.getVirtioScsi ( ) . setEnabled ( ( ! ( org.ovirt.engine.api.restapi.util.VmHelper.getVirtioScsiControllersForEntity ( this , new org.ovirt.engine.core.compat.Guid ( model.getId ( ) ) ) . isEmpty ( ) ) ) ) ; }
Source:
public void GBThresholdLessThanZero ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 2 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = - 5 ; settings.spaceThresholdPct = 10 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertTrue ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isWithinThresholds ( domain ) ) ; }

Target:
public void GBThresholdLessThanZero ( ) { org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings settings = new org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceCheckerTest.SpaceTestSettings ( ) ; settings.diskSpaceFree = 2 ; settings.diskSpaceUsed = 0 ; settings.spaceThresholdGB = - 5 ; org.ovirt.engine.core.common.businessentities.storage_domains domain = setupForSpaceTest ( settings ) ; org.junit.Assert.assertTrue ( org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker.isWithinThresholds ( domain ) ) ; }
Source:
public boolean Validate ( ) { org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation intValidation = new org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation ( ) ; intValidation.setMinimum ( 1 ) ; intValidation.setMaximum ( 65535 ) ; getSpecificStorageValue ( ) . setIsValid ( true ) ; if ( ( ( java.lang.Boolean ) ( getSpecificStorage ( ) . getEntity ( ) ) ) ) { getSpecificStorageValue ( ) . validateEntity ( new org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] { intValidation , new org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation ( ) } ) ; } return getSpecificStorageValue ( ) . getIsValid ( ) ; }

Target:
public boolean validate ( ) { org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation intValidation = new org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation ( ) ; intValidation.setMinimum ( 1 ) ; intValidation.setMaximum ( 65535 ) ; getSpecificStorageValue ( ) . setIsValid ( true ) ; if ( ( ( java.lang.Boolean ) ( getSpecificStorage ( ) . getEntity ( ) ) ) ) { getSpecificStorageValue ( ) . validateEntity ( new org.ovirt.engine.ui.uicommonweb.validation.IValidation [ ] { intValidation , new org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation ( ) } ) ; } return getSpecificStorageValue ( ) . getIsValid ( ) ; }
Source:
protected void sortStorageDomains ( java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > domainsInPool , java.util.Collection < org.ovirt.engine.core.common.businessentities.storage.DiskImage > vmDisks ) { java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > comp = null ; for ( java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > comparator : getStorageDomainComparators ( domainsInPool , vmDisks ) ) { comp = ( comp == null ) ? comparator.reversed ( ) : comp.thenComparing ( comparator.reversed ( ) ) ; } java.util.Collections.sort ( domainsInPool , comp ) ; }

Target:
protected void sortStorageDomains ( java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > domainsInPool , java.util.Collection < org.ovirt.engine.core.common.businessentities.storage.DiskImage > vmDisks ) { java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > comp = null ; for ( java.util.Comparator < org.ovirt.engine.core.common.businessentities.StorageDomain > comparator : getStorageDomainComparators ( vmDisks ) ) { comp = ( comp == null ) ? comparator.reversed ( ) : comp.thenComparing ( comparator.reversed ( ) ) ; } java.util.Collections.sort ( domainsInPool , comp ) ; }