auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void AddDaysOfWeek ( ) { java.lang.String day ; int dayIndex = 3 ; for ( int i = - 2 ; i > ( - 8 ) ; i -- ) { day = org.ovirt.engine.core.compat.DateTime.getNow ( ) . AddDays ( i ) . getDayOfWeek ( ) . toString ( ) ; mEnumValues.put ( day , dayIndex ) ; mVerbs.put ( day , day ) ; dayIndex ++ ; } }

Target:
private void AddDaysOfWeek ( ) { java.lang.String day ; int dayIndex = 3 ; for ( int i = - 2 ; i > ( - 8 ) ; i -- ) { day = org.ovirt.engine.core.compat.DateTime.getNow ( ) . AddDays ( i ) . getDayOfWeek ( ) . toString ( ) ; mEnumValues.put ( day , dayIndex ) ; mVerbs.add ( day ) ; dayIndex ++ ; } }
Source:
protected boolean validateImagesAndVMStates ( ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) . getStoragePoolId ( ) , Guid.Empty , hasImages ( ) , hasImages ( ) , hasImages ( ) , hasImages ( ) , false , true , true , null ) ; }

Target:
protected boolean validateImagesAndVMStates ( ) { return org.ovirt.engine.core.bll.ImagesHandler.PerformImagesChecks ( org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getReturnValue ( ) . getCanDoActionMessages ( ) , org.ovirt.engine.core.bll.RemoveSnapshotCommand.getVm ( ) . getStoragePoolId ( ) , Guid.Empty , hasImages ( ) , hasImages ( ) , hasImages ( ) , hasImages ( ) , true , true , null ) ; }
Source:
private void validateAndExpectMtuValidation ( org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper , org.ovirt.engine.core.common.businessentities.Network net1 , org.ovirt.engine.core.common.businessentities.Network net2 ) { validateAndExpectViolation ( helper , VdcBllMessages.NETWORK_MTU_DIFFERENCES , java.lang.String.format ( "[%s(%s), %s(%d)]" , net1.getName ( ) , ( ( net1.getMtu ( ) ) == 0 ? "default" : net1.getMtu ( ) ) , net2.getName ( ) , net2.getMtu ( ) ) ) ; }

Target:
private void validateAndExpectMtuValidation ( org.ovirt.engine.core.bll.network.host.SetupNetworksHelper helper , org.ovirt.engine.core.common.businessentities.network.Network net1 , org.ovirt.engine.core.common.businessentities.network.Network net2 ) { validateAndExpectViolation ( helper , VdcBllMessages.NETWORK_MTU_DIFFERENCES , java.lang.String.format ( "[%s(%s), %s(%d)]" , net1.getName ( ) , ( ( net1.getMtu ( ) ) == 0 ? "default" : net1.getMtu ( ) ) , net2.getName ( ) , net2.getMtu ( ) ) ) ; }
Source:
private java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > getNetworksInCluster ( ) { if ( ( networksInClusterByName ) == null ) { if ( ( clusterId ) != null ) { networksInClusterByName = org.ovirt.engine.core.common.businessentities.Entities.entitiesByName ( org.ovirt.engine.core.bll.network.vm.VnicProfileHelper.getNetworkDao ( ) . getAllForCluster ( clusterId ) ) ; } else { networksInClusterByName = new java.util.HashMap < > ( ) ; } } return networksInClusterByName ; }

Target:
private java.util.Map < java.lang.String , org.ovirt.engine.core.common.businessentities.network.Network > getNetworksInCluster ( ) { if ( ( networksInClusterByName ) == null ) { if ( ( clusterId ) != null ) { networksInClusterByName = org.ovirt.engine.core.common.businessentities.Entities.entitiesByName ( getNetworkDao ( ) . getAllForCluster ( clusterId ) ) ; } else { networksInClusterByName = new java.util.HashMap < > ( ) ; } } return networksInClusterByName ; }
Source:
public static java.util.List < java.lang.String > filterNonVmNetworkNames ( java.util.List < org.ovirt.engine.core.common.businessentities.Network > networks , java.util.Set < java.lang.String > networkNames ) { java.util.List < java.lang.String > list = new java.util.ArrayList < java.lang.String > ( ) ; for ( org.ovirt.engine.core.common.businessentities.Network net : networks ) { if ( ( ! ( net.isVmNetwork ( ) ) ) && ( networkNames.contains ( net.getName ( ) ) ) ) { list.add ( net.getName ( ) ) ; } } return list ; }

Target:
public static java.util.List < java.lang.String > filterNonVmNetworkNames ( java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > networks , java.util.Set < java.lang.String > networkNames ) { java.util.List < java.lang.String > list = new java.util.ArrayList < java.lang.String > ( ) ; for ( org.ovirt.engine.core.common.businessentities.network.Network net : networks ) { if ( ( ! ( net.isVmNetwork ( ) ) ) && ( networkNames.contains ( net.getName ( ) ) ) ) { list.add ( net.getName ( ) ) ; } } return list ; }
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.RunQuery ( VdcQueryType.OsRepository , new org.ovirt.engine.core.common.queries.OsQueryParameters ( org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb.GetDiskHotpluggableInterfacesMap ) , callback ) ; }

Target:
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 = ( ( 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:
public void canDoActionPreallocatedSpaceCheckSucceeds ( ) { final int availableSize = 12 ; final int usedSize = 8 ; org.ovirt.engine.core.compat.Guid sdid = org.ovirt.engine.core.compat.Guid.NewGuid ( ) ; initializeCommand ( sdid , VolumeType.Preallocated ) ; mockVm ( ) ; mockVmNetworks ( ) ; org.ovirt.engine.core.common.businessentities.storage_domains domains = mockStorageDomain ( sdid , availableSize , usedSize ) ; mockStoragePoolIsoMap ( ) ; mockStorageDomainSpaceCheckerRequest ( domains , true ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }

Target:
public void canDoActionPreallocatedSpaceCheckSucceeds ( ) { final int availableSize = 12 ; final int usedSize = 8 ; org.ovirt.engine.core.compat.Guid sdid = org.ovirt.engine.core.compat.Guid.NewGuid ( ) ; initializeCommand ( sdid , VolumeType.Preallocated ) ; mockVm ( ) ; org.ovirt.engine.core.common.businessentities.storage_domains domains = mockStorageDomain ( sdid , availableSize , usedSize ) ; mockStoragePoolIsoMap ( ) ; mockStorageDomainSpaceCheckerRequest ( domains , true ) ; org.junit.Assert.assertTrue ( command.canDoAction ( ) ) ; }
Source:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.UserProfile profile = userProfileDao.getByUserId ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getUserId ( ) ) ; profile.setSshPublicKey ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getParameters ( ) . getUserProfile ( ) . getSshPublicKey ( ) ) ; userProfileDao.update ( profile ) ; org.ovirt.engine.core.bll.UpdateUserProfileCommand.setSucceeded ( true ) ; }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.businessentities.UserProfile profile = org.ovirt.engine.core.bll.UpdateUserProfileCommand.getUserProfile ( ) ; profile.setSshPublicKey ( org.ovirt.engine.core.bll.UpdateUserProfileCommand.getParameters ( ) . getUserProfile ( ) . getSshPublicKey ( ) ) ; userProfileDao.update ( profile ) ; org.ovirt.engine.core.bll.UpdateUserProfileCommand.setSucceeded ( true ) ; }
Source:
public java.util.List < java.lang.Long > allocateAvailableMacs ( int numberOfMacs ) { if ( ( getAvailableMacsCount ( ) ) < numberOfMacs ) { throw new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.MAC_POOL_NO_MACS_LEFT ) ; } final java.util.List < java.lang.Long > result = new java.util.ArrayList < > ( numberOfMacs ) ; int remainingMacs = numberOfMacs ; while ( remainingMacs > 0 ) { final org.ovirt.engine.core.bll.network.macpoolmanager.Range rangeWithAvailableMac = getRangeWithAvailableMac ( ) ; final java.util.List < java.lang.Long > allocatedMacs = rangeWithAvailableMac.allocateMacs ( remainingMacs ) ; remainingMacs -= allocatedMacs.size ( ) ; result.addAll ( allocatedMacs ) ; } return result ; }

Target:
public java.util.List < java.lang.Long > allocateAvailableMacs ( int numberOfMacs ) { if ( ( getAvailableMacsCount ( ) ) < numberOfMacs ) { throw new org.ovirt.engine.core.common.errors.VdcBLLException ( org.ovirt.engine.core.common.errors.VdcBllErrors.MAC_POOL_NO_MACS_LEFT ) ; } final java.util.List < java.lang.Long > result = new java.util.ArrayList < > ( numberOfMacs ) ; int remainingMacs = numberOfMacs ; while ( remainingMacs > 0 ) { final java.util.List < java.lang.Long > allocatedMacs = getRangeWithAvailableMac ( ) . allocateMacs ( remainingMacs ) ; remainingMacs -= allocatedMacs.size ( ) ; result.addAll ( allocatedMacs ) ; } return result ; }
Source:
public void testDoGetServeFaviconNotFound ( ) throws java.io.IOException , java.net.URISyntaxException , javax.servlet.ServletException { org.mockito.Mockito.when ( mockBrandingManager.getBrandingRootPath ( ) ) . thenReturn ( new java.io.File ( this . getClass ( ) . getClassLoader ( ) . getResource ( "./org/ovirt/engine/core/branding" ) . toURI ( ) . getPath ( ) ) ) ; testServlet.doGet ( mockRequest , mockResponse ) ; org.mockito.Mockito.verify ( mockResponse ) . sendError ( HttpServletResponse.SC_NOT_FOUND ) ; }

Target:
public void testDoGetServeFaviconNotFound ( ) throws java.io.IOException , java.net.URISyntaxException , javax.servlet.ServletException { testServlet.doGet ( mockRequest , mockResponse ) ; org.mockito.Mockito.verify ( mockResponse ) . sendError ( HttpServletResponse.SC_NOT_FOUND ) ; }
Source:
public void stringToCpuTune ( ) { org.ovirt.engine.api.model.CpuTune cpuTune = org.ovirt.engine.api.restapi.types.VmMapper.stringToCpuTune ( "0#0" ) ; assertNotNull ( cpuTune ) ; assertNotNull ( cpuTune.getVCpuPin ( ) ) ; assertEquals ( 1 , cpuTune.getVCpuPin ( ) . size ( ) ) ; assertEquals ( 0 , cpuTune.getVCpuPin ( ) . get ( 0 ) . getVcpu ( ) ) ; assertEquals ( "0" , cpuTune.getVCpuPin ( ) . get ( 0 ) . getCpuSet ( ) ) ; }

Target:
public void stringToCpuTune ( ) { org.ovirt.engine.api.model.CpuTune cpuTune = org.ovirt.engine.api.restapi.types.VmMapper.stringToCpuTune ( "0#0" ) ; assertNotNull ( cpuTune ) ; assertNotNull ( cpuTune.getVCpuPin ( ) ) ; assertEquals ( 1 , cpuTune.getVCpuPin ( ) . size ( ) ) ; assertEquals ( 0 , ( ( int ) ( cpuTune.getVCpuPin ( ) . get ( 0 ) . getVcpu ( ) ) ) ) ; assertEquals ( "0" , cpuTune.getVCpuPin ( ) . get ( 0 ) . getCpuSet ( ) ) ; }
Source:
public int compare ( org.ovirt.engine.core.common.action.VdcActionParametersBase o1 , org.ovirt.engine.core.common.action.VdcActionParametersBase o2 ) { return ( ( org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) ( o1 ) ) . getDestinationImageId ( ) . compareTo ( ( ( org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) ( o2 ) ) . getDestinationImageId ( ) ) ; }

Target:
public int compare ( org.ovirt.engine.core.common.action.VdcActionParametersBase o1 , org.ovirt.engine.core.common.action.VdcActionParametersBase o2 ) { if ( ( o1 instanceof org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) && ( o2 instanceof org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) ) { return ( ( org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) ( o1 ) ) . getDestinationImageId ( ) . compareTo ( ( ( org.ovirt.engine.core.common.action.ImagesActionsParametersBase ) ( o2 ) ) . getDestinationImageId ( ) ) ; } return 0 ; }
Source:
public static void getHostPublicKey ( 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.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.RunQuery ( VdcQueryType.GetServerSSHPublicKey , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }

Target:
public static void getHostPublicKey ( 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.lang.String ) ( source ) ) : "" ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetServerSSHPublicKey , new org.ovirt.engine.core.common.queries.VdcQueryParametersBase ( ) , aQuery ) ; }
Source:
public void onLogout ( ) { org.ovirt.engine.ui.frontend.AsyncQuery query = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; query.setHandleFailure ( true ) ; query.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { Window.Location.reload ( ) ; } } ; frontend.logoffAsync ( frontend.getLoggedInUser ( ) , query ) ; }

Target:
public void onLogout ( ) { org.ovirt.engine.ui.frontend.AsyncQuery query = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; query.setHandleFailure ( true ) ; query.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object ReturnValue ) { Window.Location.reload ( ) ; } } ; frontend.logoffAsync ( query ) ; }
Source:
public void testAddIncompleteParameters ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Host model = new org.ovirt.engine.api.model.Host ( ) ; model.setName ( NAMES [ 0 ] ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Host" , "add" , "address" , "rootPassword" ) ; } }

Target:
public void testAddIncompleteParameters ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Host model = new org.ovirt.engine.api.model.Host ( ) ; model.setName ( NAMES [ 0 ] ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; control.replay ( ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Host" , "add" , "address" ) ; } }
Source:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" ) ; storageDevice2.setDevType ( "SDA" ) ; cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateBrickCommand ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Arrays.asList ( storageDevice1 , storageDevice2 ) ) , null ) ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }

Target:
public void validateFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" ) ; storageDevice2.setDevType ( "SDA" ) ; org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.action.gluster.CreateBrickParameters ( HOST_ID , "brick1" , "/gluster-bricks/brick1" , org.ovirt.engine.core.common.businessentities.RaidType.RAID0 , null , null , java.util.Arrays.asList ( storageDevice1 , storageDevice2 ) ) ) . when ( cmd ) . getParameters ( ) ; prepareMocks ( VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.validate ( ) ) ; }
Source:
private static void mockStoragePool ( org.ovirt.engine.core.bll.exportimport.ImportVmTemplateCommand command ) { final org.ovirt.engine.core.dao.StoragePoolDao dao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDao.class ) ; final org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( dao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; org.mockito.Mockito.doReturn ( dao ) . when ( command ) . getStoragePoolDao ( ) ; }

Target:
private void mockStoragePool ( ) { final org.ovirt.engine.core.dao.StoragePoolDao dao = org.mockito.Mockito.mock ( org.ovirt.engine.core.dao.StoragePoolDao.class ) ; final org.ovirt.engine.core.common.businessentities.StoragePool pool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; pool.setId ( command.getParameters ( ) . getStoragePoolId ( ) ) ; org.mockito.Mockito.when ( dao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( pool ) ; org.mockito.Mockito.doReturn ( dao ) . when ( command ) . getStoragePoolDao ( ) ; }
Source:
private void updateReportsAvailability ( ) { if ( org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . isReportsEnabled ( ) ) { java.util.List < org.ovirt.engine.ui.common.widget.action.ActionButtonDefinition < org.ovirt.engine.core.common.businessentities.StorageDomain > > resourceSubActions = org.ovirt.engine.ui.webadmin.uicommon.ReportActionsHelper.getInstance ( ) . getResourceSubActions ( "Storage" , getModelProvider ( ) ) ; if ( ( resourceSubActions != null ) && ( ( resourceSubActions.size ( ) ) > 0 ) ) { getTable ( ) . addActionButton ( new org.ovirt.engine.ui.webadmin.widget.action.WebAdminMenuBarButtonDefinition < org.ovirt.engine.core.common.businessentities.StorageDomain > ( org.ovirt.engine.ui.webadmin.section.main.view.tab.MainTabStorageView.constants.showReportStorage ( ) , resourceSubActions ) ) ; } } }

Target:
private void updateReportsAvailability ( ) { if ( org.ovirt.engine.ui.uicommonweb.ReportInit.getInstance ( ) . isReportsEnabled ( ) ) { java.util.List < org.ovirt.engine.ui.common.widget.action.ActionButtonDefinition < org.ovirt.engine.core.common.businessentities.StorageDomain > > resourceSubActions = org.ovirt.engine.ui.webadmin.uicommon.ReportActionsHelper.getInstance ( ) . getResourceSubActions ( "Storage" , getModelProvider ( ) ) ; if ( ( resourceSubActions != null ) && ( ( resourceSubActions.size ( ) ) > 0 ) ) { getTable ( ) . addActionButton ( new org.ovirt.engine.ui.webadmin.widget.action.WebAdminMenuBarButtonDefinition ( org.ovirt.engine.ui.webadmin.section.main.view.tab.MainTabStorageView.constants.showReportStorage ( ) , resourceSubActions ) ) ; } } }
Source:
private boolean registerLibvirtSecretsImpl ( org.ovirt.engine.core.common.businessentities.VDS vds , java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets , boolean clearUnusedSecrets ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = backend.getResourceManager ( ) . runVdsCommand ( VDSCommandType.RegisterLibvirtSecrets , new org.ovirt.engine.core.common.vdscommands.RegisterLibvirtSecretsVDSParameters ( vds.getId ( ) , libvirtSecrets , clearUnusedSecrets ) ) ; return returnValue.getSucceeded ( ) ; }

Target:
private boolean registerLibvirtSecretsImpl ( org.ovirt.engine.core.common.businessentities.VDS vds , java.util.List < org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret > libvirtSecrets ) { org.ovirt.engine.core.common.vdscommands.VDSReturnValue returnValue = backend.getResourceManager ( ) . runVdsCommand ( VDSCommandType.RegisterLibvirtSecrets , new org.ovirt.engine.core.common.vdscommands.RegisterLibvirtSecretsVDSParameters ( vds.getId ( ) , libvirtSecrets , false ) ) ; return returnValue.getSucceeded ( ) ; }
Source:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.RefreshGlusterHooksCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters ( org.ovirt.engine.core.bll.gluster.RefreshGlusterHooksCommandTest.CLUSTER_ID ) , null ) ) ; setupMocks ( ) ; org.mockito.Mockito.doNothing ( ) . when ( hookSyncJob ) . refreshHooksInCluster ( getCluster ( ) , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_REFRESH , cmd.getAuditLogTypeValue ( ) ) ; }

Target:
public void executeCommand ( ) { setupMocks ( ) ; org.mockito.Mockito.doNothing ( ) . when ( hookSyncJob ) . refreshHooksInCluster ( getCluster ( ) , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( AuditLogType.GLUSTER_HOOK_REFRESH , cmd.getAuditLogTypeValue ( ) ) ; }
Source:
public org.ovirt.engine.core.bll.ValidationResult isISCSIConnectionAndDomain ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { org.ovirt.engine.core.bll.ValidationResult validationResult = isSameStorageType ( storageDomain ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } org.ovirt.engine.core.common.businessentities.storage.StorageType connectionStorageType = connection.getstorage_type ( ) ; org.ovirt.engine.core.common.businessentities.storage.StorageType storageDomainType = storageDomain.getStorageType ( ) ; if ( ( ! ( connectionStorageType.equals ( StorageType.ISCSI ) ) ) || ( ! ( storageDomainType.equals ( StorageType.ISCSI ) ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_ACTION_IS_SUPPORTED_ONLY_FOR_ISCSI_DOMAINS ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }

Target:
public org.ovirt.engine.core.bll.ValidationResult isISCSIConnectionAndDomain ( org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain ) { org.ovirt.engine.core.bll.ValidationResult validationResult = isSameStorageType ( storageDomain ) ; if ( ! ( validationResult.isValid ( ) ) ) { return validationResult ; } org.ovirt.engine.core.common.businessentities.storage.StorageType connectionStorageType = connection.getStorageType ( ) ; org.ovirt.engine.core.common.businessentities.storage.StorageType storageDomainType = storageDomain.getStorageType ( ) ; if ( ( ! ( connectionStorageType.equals ( StorageType.ISCSI ) ) ) || ( ! ( storageDomainType.equals ( StorageType.ISCSI ) ) ) ) { return new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.ACTION_TYPE_FAILED_ACTION_IS_SUPPORTED_ONLY_FOR_ISCSI_DOMAINS ) ; } return org.ovirt.engine.core.bll.ValidationResult.VALID ; }
Source:
private void handlePasswordGrantType ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response , java.lang.String scope ) throws java.lang.Exception { if ( org.ovirt.engine.core.sso.utils.SSOUtils.scopeAsList ( scope ) . contains ( "ovirt-ext=token:login-on-behalf" ) ) { org.ovirt.engine.core.sso.servlets.OAuthTokenServlet.issueTokenForLoginOnBehalf ( request , response , scope ) ; } else { org.ovirt.engine.core.sso.servlets.OAuthTokenServlet.issueTokenForPasswd ( request , response , scope ) ; } }

Target:
private void handlePasswordGrantType ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response , java.lang.String scope ) throws java.lang.Exception { if ( org.ovirt.engine.core.sso.utils.SSOUtils.scopeAsList ( scope ) . contains ( "ovirt-ext=token:login-on-behalf" ) ) { issueTokenForLoginOnBehalf ( request , response , scope ) ; } else { issueTokenForPasswd ( request , response , scope ) ; } }
Source:
public void mapBackendModel ( ) { for ( org.ovirt.engine.core.common.businessentities.VmWatchdogType type : org.ovirt.engine.core.common.businessentities.VmWatchdogType.values ( ) ) { org.ovirt.engine.api.model.WatchdogModel model = org.ovirt.engine.api.restapi.types.WatchdogMapper.map ( type , null ) ; org.junit.Assert.assertNotNull ( model ) ; org.junit.Assert.assertEquals ( model.name ( ) . toLowerCase ( ) , type.name ( ) . toLowerCase ( ) ) ; } }

Target:
public void mapBackendModel ( ) { for ( org.ovirt.engine.core.common.businessentities.VmWatchdogType type : org.ovirt.engine.core.common.businessentities.VmWatchdogType.values ( ) ) { org.ovirt.engine.api.model.WatchdogModel model = org.ovirt.engine.api.restapi.types.WatchdogMapper.map ( type ) ; org.junit.Assert.assertNotNull ( model ) ; org.junit.Assert.assertEquals ( model.name ( ) . toLowerCase ( ) , type.name ( ) . toLowerCase ( ) ) ; } }
Source:
public void unlabel ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel labelModel ) { labelModel.setInterface ( null ) ; getLabels ( ) . remove ( labelModel ) ; java.util.Set < java.lang.String > labels = getIface ( ) . getLabels ( ) ; labels.remove ( labelModel.getName ( ) ) ; if ( labels.isEmpty ( ) ) { getIface ( ) . setLabels ( null ) ; } }

Target:
public void unlabel ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel labelModel ) { labelModel.setInterface ( null ) ; getLabels ( ) . remove ( labelModel ) ; }
Source:
public void testRemoveForced ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( ) ; setUpGetPayloadExpectations ( 0 ) ; setUpGetBallooningExpectations ( ) ; setUpActionExpectations ( VdcActionType.RemoveVm , org.ovirt.engine.core.common.action.RemoveVmParameters.class , new java.lang.String [ ] { "VmId" , "Force" } , new java.lang.Object [ ] { GUIDS [ 0 ] , java.lang.Boolean.TRUE } , true , true ) ; verifyRemove ( collection.remove ( GUIDS [ 0 ] . toString ( ) , new org.ovirt.engine.api.model.Action ( ) { { setForce ( true ) ; } } ) ) ; }

Target:
public void testRemoveForced ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( ) ; setUpGetPayloadExpectations ( 1 , 0 ) ; setUpGetBallooningExpectations ( 1 ) ; setUpActionExpectations ( VdcActionType.RemoveVm , org.ovirt.engine.core.common.action.RemoveVmParameters.class , new java.lang.String [ ] { "VmId" , "Force" } , new java.lang.Object [ ] { GUIDS [ 0 ] , java.lang.Boolean.TRUE } , true , true ) ; verifyRemove ( collection.remove ( GUIDS [ 0 ] . toString ( ) , new org.ovirt.engine.api.model.Action ( ) { { setForce ( true ) ; } } ) ) ; }
Source:
protected void verifyModel ( org.ovirt.engine.api.model.File model , int index ) { assertEquals ( NAMES [ index ] . toString ( ) , model.getId ( ) ) ; assertEquals ( NAMES [ index ] . toString ( ) , model.getName ( ) ) ; assertNotNull ( model.getStorageDomain ( ) ) ; assertEquals ( GUIDS [ 0 ] . toString ( ) , model.getStorageDomain ( ) . getId ( ) ) ; verifyLinks ( model ) ; }

Target:
protected void verifyModel ( org.ovirt.engine.api.model.File model , int index ) { assertEquals ( NAMES [ index ] , model.getId ( ) ) ; assertEquals ( NAMES [ index ] , model.getName ( ) ) ; assertNotNull ( model.getStorageDomain ( ) ) ; assertEquals ( GUIDS [ 0 ] . toString ( ) , model.getStorageDomain ( ) . getId ( ) ) ; verifyLinks ( model ) ; }
Source:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( org.ovirt.engine.api.restapi.resource.AbstractBackendNetworkAttachmentResourceTest.setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 , 0 , true ) ; control.replay ( ) ; try { resource.update ( getModel ( 0 ) ) ; org.ovirt.engine.api.restapi.resource.AbstractBackendNetworkAttachmentResourceTest.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( org.ovirt.engine.api.restapi.resource.AbstractBackendNetworkAttachmentResourceTest.setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( 1 , 0 , true ) ; try { resource.update ( getModel ( 0 ) ) ; org.ovirt.engine.api.restapi.resource.AbstractBackendNetworkAttachmentResourceTest.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void onBrowserEvent ( com.google.gwt.cell.client.Cell.Context context , com.google.gwt.dom.client.Element elem , com.google.gwt.dom.client.NativeEvent event ) { getCell ( ) . onBrowserEvent ( context , elem , org.ovirt.engine.ui.common.widget.table.header.AbstractHeader.getValue ( ) , org.ovirt.engine.ui.common.widget.table.header.AbstractHeader.getTooltip ( ) , event , updater ) ; if ( ( BrowserEvents.CONTEXTMENU.equals ( event.getType ( ) ) ) && ( ( contextMenuHandler ) != null ) ) { contextMenuHandler.onContextMenu ( event ) ; } }

Target:
public void onBrowserEvent ( com.google.gwt.cell.client.Cell.Context context , com.google.gwt.dom.client.Element elem , com.google.gwt.dom.client.NativeEvent event ) { getCell ( ) . onBrowserEvent ( context , elem , org.ovirt.engine.ui.common.widget.table.header.AbstractHeader.getValue ( ) , event , updater ) ; if ( ( BrowserEvents.CONTEXTMENU.equals ( event.getType ( ) ) ) && ( ( contextMenuHandler ) != null ) ) { contextMenuHandler.onContextMenu ( event ) ; } }
Source:
protected org.ovirt.engine.core.bll.GetVmConfigurationBySnapshotQuery < org.ovirt.engine.core.common.queries.GetVmConfigurationBySnapshotQueryParams > setUpSpyQuery ( org.ovirt.engine.core.common.queries.GetVmConfigurationBySnapshotQueryParams params ) throws java.lang.Exception { org.ovirt.engine.core.bll.GetVmConfigurationBySnapshotQuery < org.ovirt.engine.core.common.queries.GetVmConfigurationBySnapshotQueryParams > result = super . setUpSpyQuery ( params ) ; snapshotsManager = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.snapshots.SnapshotsManager.class ) ; org.mockito.Mockito.when ( result.getSnapshotManager ( ) ) . thenReturn ( snapshotsManager ) ; return result ; }

Target:
protected org.ovirt.engine.core.bll.GetVmConfigurationBySnapshotQuery < org.ovirt.engine.core.common.queries.IdQueryParameters > setUpSpyQuery ( org.ovirt.engine.core.common.queries.IdQueryParameters params ) throws java.lang.Exception { org.ovirt.engine.core.bll.GetVmConfigurationBySnapshotQuery < org.ovirt.engine.core.common.queries.IdQueryParameters > result = super . setUpSpyQuery ( params ) ; snapshotsManager = org.mockito.Mockito.mock ( org.ovirt.engine.core.bll.snapshots.SnapshotsManager.class ) ; org.mockito.Mockito.when ( result.getSnapshotManager ( ) ) . thenReturn ( snapshotsManager ) ; return result ; }
Source:
public void testReadAllTextTonSOfTimes ( ) throws java.lang.Exception { java.io.File iFile = java.io.File.createTempFile ( "Test" , ".txt" ) ; java.io.FileWriter iFileWriter = new java.io.FileWriter ( iFile ) ; iFileWriter.write ( "This is a test" ) ; iFileWriter.close ( ) ; for ( int i = 0 ; i < 10000 ; i ++ ) { java.lang.String data = org.ovirt.engine.core.utils.FileUtil.readAllText ( iFile.getAbsolutePath ( ) ) ; org.junit.Assert.assertEquals ( "Data should be equal" , "This is a test" , data ) ; } }

Target:
public void testReadAllTextTonSOfTimes ( ) throws java.lang.Exception { java.io.File iFile = java.io.File.createTempFile ( "Test" , ".txt" ) ; try ( java.io.FileWriter iFileWriter = new java.io.FileWriter ( iFile ) ) { iFileWriter.write ( "This is a test" ) ; } for ( int i = 0 ; i < 10000 ; i ++ ) { java.lang.String data = org.ovirt.engine.core.utils.FileUtil.readAllText ( iFile.getAbsolutePath ( ) ) ; org.junit.Assert.assertEquals ( "Data should be equal" , "This is a test" , data ) ; } }
Source:
public static java.util.Collection < java.lang.Object [ ] > namesParams ( ) { return java.util.Arrays.asList ( new java.lang.Object [ ] [ ] { new java.lang.Object [ ] { "a.a.a.a" , false , false } , new java.lang.Object [ ] { "253.0.0.32/26" , true , false } , new java.lang.Object [ ] { "255.255.255.255/32" , true , true } } ) ; }

Target:
public static java.lang.Object [ ] [ ] namesParams ( ) { return new java.lang.Object [ ] [ ] { new java.lang.Object [ ] { "a.a.a.a" , false , false } , new java.lang.Object [ ] { "253.0.0.32/26" , true , false } , new java.lang.Object [ ] { "255.255.255.255/32" , true , true } } ; }
Source:
public void isVirtioScsiEnabledDefaultedToTrue ( ) { mockOsRepository ( ) ; org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( createVdsGroup ( ) ) . when ( cmd ) . getVdsGroup ( ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( java.util.Arrays.asList ( "VirtIO_SCSI" ) ) ) ; org.junit.Assert.assertTrue ( "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3." , cmd.isVirtioScsiEnabled ( ) ) ; }

Target:
public void isVirtioScsiEnabledDefaultedToTrue ( ) { org.ovirt.engine.core.bll.AddVmCommand < org.ovirt.engine.core.common.action.VmManagementParametersBase > cmd = setupCanAddVmTests ( 0 , 0 ) ; org.mockito.Mockito.doReturn ( createVdsGroup ( ) ) . when ( cmd ) . getVdsGroup ( ) ; org.mockito.Mockito.when ( osRepository.getDiskInterfaces ( org.mockito.Matchers.any ( java.lang.Integer.class ) , org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Version.class ) ) ) . thenReturn ( new java.util.ArrayList < > ( java.util.Arrays.asList ( "VirtIO_SCSI" ) ) ) ; org.junit.Assert.assertTrue ( "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3." , cmd.isVirtioScsiEnabled ( ) ) ; }
Source:
public void testGetByServerId ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > services = dao.getByServerId ( org.ovirt.engine.core.compat.Guid.createGuidFromStringDefaultEmpty ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVER1_ID ) ) ; org.junit.Assert.assertNotNull ( services ) ; org.junit.Assert.assertEquals ( 1 , services.size ( ) ) ; verifyServiceOnServer1 ( services.get ( 0 ) ) ; }

Target:
public void testGetByServerId ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService > services = dao.getByServerId ( org.ovirt.engine.core.dao.gluster.GlusterServerServiceDaoTest.SERVER1_ID ) ; org.junit.Assert.assertNotNull ( services ) ; org.junit.Assert.assertEquals ( 1 , services.size ( ) ) ; verifyServiceOnServer1 ( services.get ( 0 ) ) ; }
Source:
public void canDoActionFailsOnNullHook ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd , false ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString ( ) ) ) ; }

Target:
public void canDoActionFailsOnNullHook ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.DisableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd , false ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; org.junit.Assert.assertTrue ( cmd.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString ( ) ) ) ; }
Source:
org.ovirt.engine.core.common.businessentities.VmwareVmProviderProperties getVmwareVmProviderProperties ( org.ovirt.engine.core.compat.Guid dataCenterId ) { return new org.ovirt.engine.core.common.businessentities.VmwareVmProviderProperties ( getvCenter ( ) . getEntity ( ) , getEsx ( ) . getEntity ( ) , getVmwareDatacenter ( ) . getEntity ( ) , getVerifySSL ( ) . getEntity ( ) , dataCenterId , ( ( getProxyHost ( ) ) != null ? getProxyHost ( ) . getSelectedItem ( ) . getId ( ) : null ) ) ; }

Target:
org.ovirt.engine.core.common.businessentities.VmwareVmProviderProperties getVmwareVmProviderProperties ( org.ovirt.engine.core.compat.Guid dataCenterId ) { return new org.ovirt.engine.core.common.businessentities.VmwareVmProviderProperties ( getvCenter ( ) . getEntity ( ) , getEsx ( ) . getEntity ( ) , getVmwareDatacenter ( ) . getEntity ( ) , getVerifySSL ( ) . getEntity ( ) , dataCenterId , ( ( getProxyHost ( ) . getSelectedItem ( ) ) != null ? getProxyHost ( ) . getSelectedItem ( ) . getId ( ) : null ) ) ; }
Source:
private void failover ( ) { if ( ( ( ( org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.getParameters ( ) . getIgnoreFailoverLimit ( ) ) || ( ( _failoverCounter ) < ( ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > GetValue ( ConfigValues.SpmCommandFailOverRetries ) ) - 1 ) ) ) && ( getCurrentIrsProxyData ( ) . getHasVdssForSpmSelection ( ) ) ) && ( getCurrentIrsProxyData ( ) . failover ( ) ) ) { ( _failoverCounter ) ++ ; org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.executeCommand ( ) ; } else { org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; } }

Target:
private void failover ( ) { if ( ( ( ( org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.getParameters ( ) . getIgnoreFailoverLimit ( ) ) || ( ( _failoverCounter ) < ( ( org.ovirt.engine.core.common.config.Config.< java.lang.Integer > getValue ( ConfigValues.SpmCommandFailOverRetries ) ) - 1 ) ) ) && ( getCurrentIrsProxyData ( ) . getHasVdssForSpmSelection ( ) ) ) && ( getCurrentIrsProxyData ( ) . failover ( ) ) ) { ( _failoverCounter ) ++ ; org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.executeCommand ( ) ; } else { org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand.getVDSReturnValue ( ) . setSucceeded ( false ) ; } }
Source:
public void testChanges ( ) { org.ovirt.engine.core.utils.Jedi jedi1 = new org.ovirt.engine.core.utils.Jedi ( ) ; org.ovirt.engine.core.utils.Jedi jedi2 = new org.ovirt.engine.core.utils.Jedi ( ) ; jedi2.saberColor = "red" ; java.util.ArrayList < java.lang.String > changes = org.ovirt.engine.core.utils.ObjectIdentityChecker.GetChangedFields ( jedi1 , jedi2 ) ; assertTrue ( "Should be 1 changes" , ( ( changes.size ( ) ) == 1 ) ) ; }

Target:
public void testChanges ( ) { org.ovirt.engine.core.utils.Jedi jedi1 = new org.ovirt.engine.core.utils.Jedi ( ) ; org.ovirt.engine.core.utils.Jedi jedi2 = new org.ovirt.engine.core.utils.Jedi ( ) ; jedi2.saberColor = "red" ; java.util.List < java.lang.String > changes = org.ovirt.engine.core.utils.ObjectIdentityChecker.GetChangedFields ( jedi1 , jedi2 ) ; assertTrue ( "Should be 1 changes" , ( ( changes.size ( ) ) == 1 ) ) ; }
Source:
public void replaceWithNameableCollection ( ) { org.ovirt.engine.core.common.businessentities.Nameable item = new org.ovirt.engine.core.common.businessentities.Nameable ( ) { @ java.lang.Override public java.lang.String getName ( ) { return org.ovirt.engine.core.utils.ReplacementUtilsTest.PROPERTY_VALUE ; } } ; java.util.List < org.ovirt.engine.core.common.businessentities.Nameable > items = java.util.Collections.singletonList ( item ) ; validateReplacements ( org.ovirt.engine.core.utils.ReplacementUtils.replaceWithNameable ( org.ovirt.engine.core.utils.ReplacementUtilsTest.PROPERTY_NAME , items ) , items ) ; }

Target:
public void replaceWithNameableCollection ( ) { org.ovirt.engine.core.common.businessentities.Nameable item = ( ) -> org.ovirt.engine.core.utils.ReplacementUtilsTest.PROPERTY_VALUE ; java.util.List < org.ovirt.engine.core.common.businessentities.Nameable > items = java.util.Collections.singletonList ( item ) ; validateReplacements ( org.ovirt.engine.core.utils.ReplacementUtils.replaceWithNameable ( org.ovirt.engine.core.utils.ReplacementUtilsTest.PROPERTY_NAME , items ) , items ) ; }
Source:
private void initStoragePool ( ) { storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; storagePool.setCompatibilityVersion ( Version.v3_5 ) ; org.mockito.Mockito.when ( storagePoolDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( storagePool ) ; org.mockito.Mockito.when ( command.getStoragePoolId ( ) ) . thenReturn ( storagePoolId ) ; }

Target:
private void initStoragePool ( ) { storagePool = new org.ovirt.engine.core.common.businessentities.StoragePool ( ) ; org.mockito.Mockito.when ( storagePoolDao.get ( org.mockito.Matchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ) . thenReturn ( storagePool ) ; org.mockito.Mockito.when ( command.getStoragePoolId ( ) ) . thenReturn ( storagePoolId ) ; }
Source:
public static void assertNoDuplicateKeys ( java.lang.String filePath ) throws java.io.FileNotFoundException { java.io.InputStream is = new java.io.FileInputStream ( filePath ) ; org.ovirt.engine.core.utils.NoDuplicateProperties props = new org.ovirt.engine.core.utils.NoDuplicateProperties ( ) ; try { props.load ( is ) ; } catch ( java.lang.Exception exception ) { org.junit.Assert.fail ( ( ( ( "Check for duplicate keys in " + filePath ) + " failed: " ) + ( exception.getMessage ( ) ) ) ) ; } }

Target:
public static void assertNoDuplicateKeys ( java.lang.String filePath ) throws java.io.FileNotFoundException { org.ovirt.engine.core.utils.NoDuplicateProperties props = new org.ovirt.engine.core.utils.NoDuplicateProperties ( ) ; try ( java.io.InputStream is = new java.io.FileInputStream ( filePath ) ) { props.load ( is ) ; } catch ( java.lang.Exception exception ) { org.junit.Assert.fail ( ( ( ( "Check for duplicate keys in " + filePath ) + " failed: " ) + ( exception.getMessage ( ) ) ) ) ; } }
Source:
public void run ( ) { try { org.ovirt.engine.core.notifier.NotificationService.log.debug ( "Start event notification service iteration" ) ; startup ( ) ; processEvents ( ) ; if ( shouldDeleteHistory ) { deleteObseleteHistoryData ( ) ; } org.ovirt.engine.core.notifier.NotificationService.log.debug ( "Finish event notification service iteration" ) ; } catch ( java.lang.Throwable e ) { if ( ! ( java.lang.Thread.interrupted ( ) ) ) { org.ovirt.engine.core.notifier.NotificationService.log.error ( java.lang.String.format ( "Failed to run the service: [%s]" , e.getMessage ( ) ) , e ) ; } } }

Target:
public void run ( ) { try { org.ovirt.engine.core.notifier.NotificationService.log.debug ( "Start event notification service iteration" ) ; processEvents ( ) ; if ( shouldDeleteHistory ) { deleteObseleteHistoryData ( ) ; } org.ovirt.engine.core.notifier.NotificationService.log.debug ( "Finish event notification service iteration" ) ; } catch ( java.lang.Throwable e ) { if ( ! ( java.lang.Thread.interrupted ( ) ) ) { org.ovirt.engine.core.notifier.NotificationService.log.error ( java.lang.String.format ( "Failed to run the service: [%s]" , e.getMessage ( ) ) , e ) ; } } }
Source:
public org.ovirt.engine.core.common.businessentities.storage.VolumeClassification deleteVolumeByClassificationType ( org.ovirt.engine.core.common.businessentities.storage.CinderDisk cinderDisk ) { org.ovirt.engine.core.common.businessentities.storage.VolumeClassification cinderVolumeType = cinderDisk.getVolumeClassification ( ) ; if ( cinderVolumeType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Volume ) ) { deleteVolume ( cinderDisk ) ; } else if ( cinderVolumeType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Snapshot ) ) { deleteSnapshot ( cinderDisk.getImageId ( ) ) ; } else { org.ovirt.engine.core.bll.storage.CinderBroker.log.error ( "Error, could not determine Cinder entity with id from Cinder provider." , cinderDisk.getDiskAlias ( ) , cinderDisk.getImageId ( ) ) ; } return cinderVolumeType ; }

Target:
public org.ovirt.engine.core.common.businessentities.storage.VolumeClassification deleteVolumeByClassificationType ( org.ovirt.engine.core.common.businessentities.storage.CinderDisk cinderDisk ) { org.ovirt.engine.core.common.businessentities.storage.VolumeClassification cinderVolumeType = cinderDisk.getVolumeClassification ( ) ; if ( cinderVolumeType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Volume ) ) { deleteVolume ( cinderDisk ) ; } else if ( cinderVolumeType == ( org.ovirt.engine.core.common.businessentities.storage.VolumeClassification.Snapshot ) ) { deleteSnapshot ( cinderDisk.getImageId ( ) ) ; } org.ovirt.engine.core.bll.storage.CinderBroker.log.error ( "Error, could not determine Cinder entity with id from Cinder provider." , cinderDisk.getDiskAlias ( ) , cinderDisk.getImageId ( ) ) ; return cinderVolumeType ; }
Source:
private java.util.List < org.ovirt.engine.core.common.businessentities.storage_pool > asList ( java.lang.Object returnValue ) { if ( returnValue instanceof java.util.ArrayList ) { return ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > ) ( returnValue ) ) ; } if ( returnValue instanceof org.ovirt.engine.core.common.businessentities.storage_pool ) { java.util.List < org.ovirt.engine.core.common.businessentities.storage_pool > res = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > ( ) ; res.add ( ( ( org.ovirt.engine.core.common.businessentities.storage_pool ) ( returnValue ) ) ) ; return res ; } throw new java.lang.IllegalArgumentException ( ( "Expected ArrayList of storage_pools or a storage_pool. Given " + ( returnValue.getClass ( ) . getName ( ) ) ) ) ; }

Target:
private java.util.List < org.ovirt.engine.core.common.businessentities.StoragePool > asList ( java.lang.Object returnValue ) { if ( returnValue instanceof java.util.ArrayList ) { return ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( returnValue ) ) ; } if ( returnValue instanceof org.ovirt.engine.core.common.businessentities.StoragePool ) { java.util.List < org.ovirt.engine.core.common.businessentities.StoragePool > res = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ( ) ; res.add ( ( ( org.ovirt.engine.core.common.businessentities.StoragePool ) ( returnValue ) ) ) ; return res ; } throw new java.lang.IllegalArgumentException ( ( "Expected ArrayList of storage_pools or a storage_pool. Given " + ( returnValue.getClass ( ) . getName ( ) ) ) ) ; }
Source:
public void getExistingVariable ( ) { org.ovirt.engine.core.common.ExternalVariable expected = new org.ovirt.engine.core.common.ExternalVariable ( ) ; expected.setName ( "fence-kdump-listener" ) ; org.ovirt.engine.core.common.ExternalVariable found = dbFacade.getExternalVariableDao ( ) . get ( expected.getName ( ) ) ; org.junit.Assert.assertNotNull ( found ) ; org.junit.Assert.assertEquals ( expected , found ) ; org.junit.Assert.assertNotNull ( found.getUpdateDate ( ) ) ; }

Target:
public void getExistingVariable ( ) { org.ovirt.engine.core.common.ExternalVariable expected = new org.ovirt.engine.core.common.ExternalVariable ( ) ; expected.setName ( "fence-kdump-listener" ) ; org.ovirt.engine.core.common.ExternalVariable found = dao.get ( expected.getName ( ) ) ; org.junit.Assert.assertNotNull ( found ) ; org.junit.Assert.assertEquals ( expected , found ) ; org.junit.Assert.assertNotNull ( found.getUpdateDate ( ) ) ; }