auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void refreshHeavyWeightData ( ) { log.debug ( "Refreshing Gluster Data [heavyweight]" ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : getClusterDao ( ) . getAll ( ) ) { if ( ( org.ovirt.engine.core.common.gluster.GlusterFeatureSupported.refreshHeavyWeight ( cluster.getcompatibility_version ( ) ) ) && ( cluster.supportsGlusterService ( ) ) ) { try { refreshClusterHeavyWeightData ( cluster ) ; } catch ( java.lang.Exception e ) { log.errorFormat ( "Error while refreshing Gluster heavyweight data of cluster {0}!" , cluster.getname ( ) , e ) ; } } } }

Target:
public void refreshHeavyWeightData ( ) { log.debug ( "Refreshing Gluster Data [heavyweight]" ) ; for ( org.ovirt.engine.core.common.businessentities.VDSGroup cluster : getClusterDao ( ) . getAll ( ) ) { if ( ( org.ovirt.engine.core.common.gluster.GlusterFeatureSupported.refreshHeavyWeight ( cluster.getcompatibility_version ( ) ) ) && ( cluster.supportsGlusterService ( ) ) ) { try { refreshClusterHeavyWeightData ( cluster ) ; } catch ( java.lang.Exception e ) { log.errorFormat ( "Error while refreshing Gluster heavyweight data of cluster {0}!" , cluster.getName ( ) , e ) ; } } } }
Source:
public void newNetworkQoS ( ) { if ( ( getWindow ( ) ) != null ) { return ; } final org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel newNetworkQoSModel = new org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel ( this ) ; setWindow ( newNetworkQoSModel ) ; newNetworkQoSModel.getDataCenters ( ) . setItems ( java.util.Arrays.asList ( getEntity ( ) ) ) ; newNetworkQoSModel.getDataCenters ( ) . setSelectedItem ( getEntity ( ) ) ; }

Target:
public void newNetworkQoS ( ) { if ( ( getWindow ( ) ) != null ) { return ; } final org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel newNetworkQoSModel = new org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkQoSModel ( this , getEntity ( ) ) ; setWindow ( newNetworkQoSModel ) ; newNetworkQoSModel.getDataCenters ( ) . setItems ( java.util.Arrays.asList ( getEntity ( ) ) ) ; newNetworkQoSModel.getDataCenters ( ) . setSelectedItem ( getEntity ( ) ) ; }
Source:
public void testGetAllWithQuery ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.NetworkView > result = dao.getAllWithQuery ( java.lang.String.format ( "SELECT * FROM network_view where id = '%s'" , FixturesTool.NETWORK_ENGINE ) ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( FixturesTool.NETWORK_ENGINE , result.get ( 0 ) . getNetwork ( ) . getId ( ) ) ; }

Target:
public void testGetAllWithQuery ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.NetworkView > result = dao.getAllWithQuery ( java.lang.String.format ( "SELECT * FROM network_view where id = '%s'" , FixturesTool.NETWORK_ENGINE ) ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( FixturesTool.NETWORK_ENGINE , result.get ( 0 ) . getId ( ) ) ; }
Source:
public void vmIdRefNullVm ( ) { final org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase b = new org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase ( ) ; b.setVmId ( null ) ; final org.ovirt.engine.core.common.businessentities.VM v = new org.ovirt.engine.core.common.businessentities.VM ( ) ; v.setId ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID ) ; b.setVm ( v ) ; final org.ovirt.engine.core.compat.Guid g = b.getVmIdRef ( ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID , g ) ; }

Target:
public void vmIdRefNullVm ( ) { b.setVmId ( null ) ; final org.ovirt.engine.core.common.businessentities.VM v = new org.ovirt.engine.core.common.businessentities.VM ( ) ; v.setId ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID ) ; b.setVm ( v ) ; final org.ovirt.engine.core.compat.Guid g = b.getVmIdRef ( ) ; org.junit.Assert.assertEquals ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseTest.GUID , g ) ; }
Source:
public void testUpdate ( ) { org.ovirt.engine.core.common.businessentities.Network before = dao.getByName ( org.ovirt.engine.core.dao.NetworkDAOTest.EXISTING_NETWORK_NAME ) ; before.setdescription ( "This is a completely changed description" ) ; dao.update ( before ) ; org.ovirt.engine.core.common.businessentities.Network after = dao.getByName ( org.ovirt.engine.core.dao.NetworkDAOTest.EXISTING_NETWORK_NAME ) ; org.junit.Assert.assertNotNull ( after ) ; org.junit.Assert.assertEquals ( before , after ) ; }

Target:
public void testUpdate ( ) { org.ovirt.engine.core.common.businessentities.network.Network before = dao.getByName ( org.ovirt.engine.core.dao.NetworkDAOTest.EXISTING_NETWORK_NAME ) ; before.setdescription ( "This is a completely changed description" ) ; dao.update ( before ) ; org.ovirt.engine.core.common.businessentities.network.Network after = dao.getByName ( org.ovirt.engine.core.dao.NetworkDAOTest.EXISTING_NETWORK_NAME ) ; org.junit.Assert.assertNotNull ( after ) ; org.junit.Assert.assertEquals ( before , after ) ; }
Source:
private void initCommand ( ) { org.mockito.Mockito.when ( diskDao.get ( diskId ) ) . thenReturn ( createDiskImage ( ) ) ; org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters parameters = createParameters ( ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.disk.AttachDiskToVmCommand < org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters > ( parameters ) { @ java.lang.SuppressWarnings ( value = "synthetic-access" ) @ java.lang.Override public org.ovirt.engine.core.dao.DiskDao getDiskDao ( ) { return diskDao ; } } ) ; }

Target:
private void initCommand ( ) { org.mockito.Mockito.when ( diskDao.get ( diskId ) ) . thenReturn ( createDiskImage ( ) ) ; org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters parameters = createParameters ( ) ; command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.storage.disk.AttachDiskToVmCommand < org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters > ( parameters , null ) { @ java.lang.SuppressWarnings ( value = "synthetic-access" ) @ java.lang.Override public org.ovirt.engine.core.dao.DiskDao getDiskDao ( ) { return diskDao ; } } ) ; }
Source:
public void put ( final org.ovirt.engine.core.common.businessentities.CommandEntity cmdEntity ) { commandMap.put ( cmdEntity.getId ( ) , cmdEntity ) ; org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope ( TransactionScopeOption.Required , new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Object > ( ) { @ java.lang.Override public java.lang.Void runInTransaction ( ) { org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getCommandEntityDao ( ) . saveOrUpdate ( cmdEntity ) ; return null ; } } ) ; }

Target:
public void put ( final org.ovirt.engine.core.common.businessentities.CommandEntity cmdEntity ) { commandMap.put ( cmdEntity.getId ( ) , cmdEntity ) ; org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getCommandEntityDao ( ) . saveOrUpdate ( cmdEntity ) ; }
Source:
public boolean equals ( java.lang.Object o ) { if ( ( this ) == o ) return true ; if ( ! ( o instanceof org.ovirt.engine.core.common.businessentities.network.IpConfiguration ) ) return false ; org.ovirt.engine.core.common.businessentities.network.IpConfiguration that = ( ( org.ovirt.engine.core.common.businessentities.network.IpConfiguration ) ( o ) ) ; return ( java.util.Objects.equals ( getBootProtocol ( ) , that.getBootProtocol ( ) ) ) && ( java.util.Objects.equals ( getIPv4Addresses ( ) , that.getIPv4Addresses ( ) ) ) ; }

Target:
public boolean equals ( java.lang.Object o ) { if ( ( this ) == o ) return true ; if ( ! ( o instanceof org.ovirt.engine.core.common.businessentities.network.IpConfiguration ) ) return false ; org.ovirt.engine.core.common.businessentities.network.IpConfiguration that = ( ( org.ovirt.engine.core.common.businessentities.network.IpConfiguration ) ( o ) ) ; return java.util.Objects.equals ( getIPv4Addresses ( ) , that.getIPv4Addresses ( ) ) ; }
Source:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { java.lang.Object [ ] array = ( ( java.lang.Object [ ] ) ( target ) ) ; org.ovirt.engine.ui.uicommonweb.models.vms.ExistingVmModelBehavior behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.ExistingVmModelBehavior ) ( array [ 0 ] ) ) ; org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( array [ 1 ] ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > clusters = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ) ( returnValue ) ) ; InitClusters ( clusters , model ) ; behavior.InitTemplate ( ) ; behavior.InitCdImage ( ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { java.lang.Object [ ] array = ( ( java.lang.Object [ ] ) ( target ) ) ; org.ovirt.engine.ui.uicommonweb.models.vms.ExistingVmModelBehavior behavior = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.ExistingVmModelBehavior ) ( array [ 0 ] ) ) ; org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( array [ 1 ] ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > clusters = ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VDSGroup > ) ( returnValue ) ) ; InitClusters ( clusters , model ) ; behavior.InitTemplate ( ) ; behavior.InitCdImage ( ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getStorageServerConnectionLunMapDao ( ) ; org.ovirt.engine.core.dao.StorageServerConnectionDao storageServerConnectionDao = dbFacade.getStorageServerConnectionDao ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections existingConnection = storageServerConnectionDao.get ( "0cc146e8-e5ed-482c-8814-270bc48c297e" ) ; existingLUNStorageMap = dao.get ( new org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId ( "1IET_00180001" , existingConnection.getid ( ) ) ) ; newLUNStorageMap = new org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap ( org.ovirt.engine.core.dao.StorageServerConnectionLunMapDaoTest.FREE_LUN_ID , existingConnection.getid ( ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getStorageServerConnectionLunMapDao ( ) ; org.ovirt.engine.core.dao.StorageServerConnectionDao storageServerConnectionDao = dbFacade.getStorageServerConnectionDao ( ) ; org.ovirt.engine.core.common.businessentities.StorageServerConnections existingConnection = storageServerConnectionDao.get ( "0cc146e8-e5ed-482c-8814-270bc48c297e" ) ; existingLUNStorageMap = dao.get ( new org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId ( "1IET_00180001" , existingConnection.getId ( ) ) ) ; newLUNStorageMap = new org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap ( org.ovirt.engine.core.dao.StorageServerConnectionLunMapDaoTest.FREE_LUN_ID , existingConnection.getId ( ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { if ( ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Quota > ) ( ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValue ) ) . getReturnValue ( ) ) ) . size ( ) ) == 0 ) { promptNoQuotaInDCMessage ( ) ; } else { onSaveInternal ( ) ; } }

Target:
public void onSuccess ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue ) { if ( ( ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.Quota > ) ( returnValue.getReturnValue ( ) ) ) . size ( ) ) == 0 ) { promptNoQuotaInDCMessage ( ) ; } else { onSaveInternal ( ) ; } }
Source:
private void setupCanAddPpcTest ( ) { org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . validateSpaceRequirements ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . buildAndCheckDestStorageDomains ( ) ; cmd.getParameters ( ) . getVm ( ) . setClusterArch ( ArchitectureType.ppc64 ) ; cluster.setArchitecture ( ArchitectureType.ppc64 ) ; cluster.setCompatibilityVersion ( org.ovirt.engine.core.compat.Version.getLast ( ) ) ; }

Target:
private void setupCanAddPpcTest ( ) { org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . buildAndCheckDestStorageDomains ( ) ; cmd.getParameters ( ) . getVm ( ) . setClusterArch ( ArchitectureType.ppc64 ) ; cluster.setArchitecture ( ArchitectureType.ppc64 ) ; cluster.setCompatibilityVersion ( org.ovirt.engine.core.compat.Version.getLast ( ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getDiskImageDynamicDao ( ) ) ; imageDao = prepareDAO ( dbFacade.getImageDao ( ) ) ; diskDao = prepareDAO ( dbFacade.getBaseDiskDao ( ) ) ; existingDynamic = dao.get ( org.ovirt.engine.core.dao.DiskImageDynamicDAOTest.EXISTING_IMAGE_ID ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getDiskImageDynamicDao ( ) ; imageDao = dbFacade.getImageDao ( ) ; diskDao = dbFacade.getBaseDiskDao ( ) ; existingDynamic = dao.get ( org.ovirt.engine.core.dao.DiskImageDynamicDAOTest.EXISTING_IMAGE_ID ) ; }
Source:
public void setSearchStringPrefix ( java.lang.String searchStringPrefix ) { searchStringPrefixLabel.setText ( searchStringPrefix ) ; oracle.setSearchPrefix ( searchStringPrefix ) ; int searchStringInputWidth = ( org.ovirt.engine.ui.webadmin.section.main.view.SearchPanelView.SEARCH_PANEL_WIDTH ) - ( searchStringPrefixLabel.getElement ( ) . getOffsetWidth ( ) ) ; searchStringInput.getElement ( ) . getStyle ( ) . setWidth ( searchStringInputWidth , Unit.PX ) ; }

Target:
public void setSearchStringPrefix ( java.lang.String searchStringPrefix ) { searchStringPrefixLabel.setText ( searchStringPrefix ) ; oracle.setSearchPrefix ( searchStringPrefix ) ; }
Source:
static void checkSeverities ( ) { org.ovirt.engine.core.common.AuditLogType [ ] values = org.ovirt.engine.core.common.AuditLogType.values ( ) ; if ( ( values.length ) != ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.mSeverities.size ( ) ) ) { for ( org.ovirt.engine.core.common.AuditLogType value : values ) { if ( ! ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.mSeverities.containsKey ( value ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warnFormat ( "AuditLogType: {0} not have severity. Assumed Normal" , value.toString ( ) ) ; } } } }

Target:
private static void checkSeverities ( ) { org.ovirt.engine.core.common.AuditLogType [ ] values = org.ovirt.engine.core.common.AuditLogType.values ( ) ; if ( ( values.length ) != ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.severities.size ( ) ) ) { for ( org.ovirt.engine.core.common.AuditLogType value : values ) { if ( ! ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.severities.containsKey ( value ) ) ) { org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector.log.warnFormat ( "AuditLogType: {0} not have severity. Assumed Normal" , value.toString ( ) ) ; } } } }
Source:
public void testFetchSpecificQuotaUsageForSpecificCluster ( ) throws java.lang.Exception { java.util.List < org.ovirt.engine.core.common.businessentities.QuotaCluster > quotaClusterList = dao.getQuotaClusterByClusterGuid ( FixturesTool.CLUSTER_RHEL6_ISCSI , FixturesTool.QUOTA_SPECIFIC ) ; org.ovirt.engine.core.common.businessentities.QuotaCluster quotaCluster = quotaClusterList.get ( 0 ) ; org.junit.Assert.assertNotNull ( quotaCluster ) ; org.junit.Assert.assertEquals ( true , ( ( quotaClusterList.size ( ) ) == 1 ) ) ; org.junit.Assert.assertEquals ( quotaCluster.getVirtualCpu ( ) , java.lang.Integer.valueOf ( 10 ) ) ; }

Target:
public void testFetchSpecificQuotaUsageForSpecificCluster ( ) throws java.lang.Exception { java.util.List < org.ovirt.engine.core.common.businessentities.QuotaCluster > quotaClusterList = dao.getQuotaClusterByClusterGuid ( FixturesTool.CLUSTER_RHEL6_ISCSI , FixturesTool.QUOTA_SPECIFIC ) ; org.ovirt.engine.core.common.businessentities.QuotaCluster quotaCluster = quotaClusterList.get ( 0 ) ; org.junit.Assert.assertNotNull ( quotaCluster ) ; org.junit.Assert.assertEquals ( 1 , quotaClusterList.size ( ) ) ; org.junit.Assert.assertEquals ( java.lang.Integer.valueOf ( 10 ) , quotaCluster.getVirtualCpu ( ) ) ; }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { disk.getIsInternal ( ) . setEntity ( false ) ; revealStorageView ( disk ) ; if ( ( ( java.lang.Boolean ) ( disk.getAttachDisk ( ) . getEntity ( ) ) ) ) { revealDiskPanel ( disk ) ; } else { externalDiskPanel.setVisible ( true ) ; } }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { disk.getIsInternal ( ) . setEntity ( false ) ; revealStorageView ( disk ) ; revealDiskPanel ( disk ) ; }
Source:
public void canSetNumaConfigurationWithVmFromDb ( ) { mockCommandWithVmFromDb ( ) ; command.executeCommand ( ) ; org.mockito.Mockito.verify ( vmNumaNodeDao ) . massRemoveNumaNodeByNumaNodeId ( org.mockito.ArgumentMatchers.eq ( existingNumaNodeIds ) ) ; org.mockito.Mockito.verify ( vmNumaNodeDao ) . massSaveNumaNode ( org.mockito.ArgumentMatchers.eq ( paramNumaNodes ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; }

Target:
public void canSetNumaConfigurationWithVmFromDb ( ) { mockCommandWithVmFromDb ( ) ; command.executeCommand ( ) ; org.mockito.Mockito.verify ( vmNumaNodeDao ) . massRemoveNumaNodeByNumaNodeId ( org.mockito.ArgumentMatchers.eq ( existingNumaNodeIds ) ) ; org.mockito.Mockito.verify ( vmNumaNodeDao ) . massSaveNumaNode ( org.mockito.ArgumentMatchers.eq ( paramNumaNodes ) , org.mockito.ArgumentMatchers.any ( ) ) ; }
Source:
public void testUpdateByVolumeIdAndName ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig config = dao.getConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 ) ; org.junit.Assert.assertNotNull ( config ) ; org.junit.Assert.assertEquals ( config.getParamValue ( ) , "value1" ) ; dao.updateConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 , "new_value" ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig modifiedConfig = dao.getConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 ) ; org.junit.Assert.assertNotNull ( modifiedConfig ) ; org.junit.Assert.assertEquals ( modifiedConfig.getParamValue ( ) , "new_value" ) ; }

Target:
public void testUpdateByVolumeIdAndName ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig config = dao.getConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 ) ; org.junit.Assert.assertNotNull ( config ) ; org.junit.Assert.assertEquals ( "value1" , config.getParamValue ( ) ) ; dao.updateConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 , "new_value" ) ; org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig modifiedConfig = dao.getConfigByVolumeIdAndName ( org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.CLUSTER_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.VOLUME_ID , org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoTest.PARAM_NAME_1 ) ; org.junit.Assert.assertNotNull ( modifiedConfig ) ; org.junit.Assert.assertEquals ( "new_value" , modifiedConfig.getParamValue ( ) ) ; }
Source:
public void testGetNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( VdcQueryType.GetNetworkLabelsByNetworkId , org.ovirt.engine.core.common.queries.IdQueryParameters.class , new java.lang.String [ ] { "Id" } , new java.lang.Object [ ] { BackendNetworkLabelsResourceTest.networkId } , java.util.Collections.emptyList ( ) ) ; control.replay ( ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testGetNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpEntityQueryExpectations ( java.util.Collections.emptyList ( ) ) ; control.replay ( ) ; try { resource.get ( ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = prepareDAO ( dbFacade.getVdsSpmIdMapDao ( ) ) ; vdsDao = prepareDAO ( dbFacade.getVdsDao ( ) ) ; existingVds = vdsDao.get ( org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.EXISTING_VDS_ID ) ; existingVdsSpmIdMap = dao.get ( existingVds.getId ( ) ) ; newVdsSpmIdMap = new org.ovirt.engine.core.common.businessentities.vds_spm_id_map ( org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.FREE_STORAGE_POOL_ID , org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.FREE_VDS_ID , 1 ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; dao = dbFacade.getVdsSpmIdMapDao ( ) ; vdsDao = dbFacade.getVdsDao ( ) ; existingVds = vdsDao.get ( org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.EXISTING_VDS_ID ) ; existingVdsSpmIdMap = dao.get ( existingVds.getId ( ) ) ; newVdsSpmIdMap = new org.ovirt.engine.core.common.businessentities.vds_spm_id_map ( org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.FREE_STORAGE_POOL_ID , org.ovirt.engine.core.dao.VdsSpmIdMapDAOTest.FREE_VDS_ID , 1 ) ; }
Source:
protected static boolean IsLegalClusterId ( org.ovirt.engine.core.compat.Guid clusterId , java.util.ArrayList < java.lang.String > reasons ) { org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsGroupDAO ( ) . get ( clusterId ) ; boolean legalClusterId = vdsGroup != null ; if ( ! legalClusterId ) { reasons.add ( VdcBllErrors.VM_INVALID_SERVER_CLUSTER_ID.toString ( ) ) ; } return legalClusterId ; }

Target:
protected static boolean IsLegalClusterId ( org.ovirt.engine.core.compat.Guid clusterId , java.util.List < java.lang.String > reasons ) { org.ovirt.engine.core.common.businessentities.VDSGroup vdsGroup = org.ovirt.engine.core.dal.dbbroker.DbFacade.getInstance ( ) . getVdsGroupDAO ( ) . get ( clusterId ) ; boolean legalClusterId = vdsGroup != null ; if ( ! legalClusterId ) { reasons.add ( VdcBllErrors.VM_INVALID_SERVER_CLUSTER_ID.toString ( ) ) ; } return legalClusterId ; }
Source:
public void testStorageLinks ( ) throws java.lang.Exception { org.ovirt.engine.api.model.HostStorage storage = new org.ovirt.engine.api.model.HostStorage ( ) ; storage.setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.STORAGE_ID ) ; storage.setHost ( new org.ovirt.engine.api.model.Host ( ) ) ; storage.getHost ( ) . setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.HOST_ID ) ; org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( setUpUriExpectations ( ) , storage ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.STORAGE_HREF , storage.getHref ( ) ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.HOST_HREF , storage.getHost ( ) . getHref ( ) ) ; }

Target:
public void testStorageLinks ( ) throws java.lang.Exception { org.ovirt.engine.api.model.HostStorage storage = new org.ovirt.engine.api.model.HostStorage ( ) ; storage.setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.STORAGE_ID ) ; storage.setHost ( new org.ovirt.engine.api.model.Host ( ) ) ; storage.getHost ( ) . setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.HOST_ID ) ; org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( storage ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.STORAGE_HREF , storage.getHref ( ) ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.HOST_HREF , storage.getHost ( ) . getHref ( ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; org.mockito.Mockito.when ( storageDomainDaoMock.getHostedEngineStorageDomainIds ( ) ) . thenReturn ( java.util.Collections.emptyList ( ) ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( getQuery ( ) ) . connectStorageDomain ( org.mockito.ArgumentMatchers.eq ( storageDomain ) ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( getQuery ( ) ) . disconnectStorageDomain ( org.mockito.ArgumentMatchers.eq ( storageDomain ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { super . setUp ( ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( getQuery ( ) ) . connectStorageDomain ( org.mockito.ArgumentMatchers.eq ( storageDomain ) ) ; org.mockito.Mockito.doReturn ( java.lang.Boolean.TRUE ) . when ( getQuery ( ) ) . disconnectStorageDomain ( org.mockito.ArgumentMatchers.eq ( storageDomain ) ) ; }
Source:
public void onFailureAlertShown ( ) { mockExecutor ( false ) ; try { command.executeCommand ( ) ; org.junit.Assert.fail ( ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException ex ) { org.mockito.Mockito.verify ( auditLogDirector , org.mockito.Mockito.times ( 3 ) ) . log ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable.class ) , org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.AuditLogType.class ) ) ; } }

Target:
public void onFailureAlertShown ( ) { mockExecutor ( false ) ; try { command.executeCommand ( ) ; org.junit.Assert.fail ( ) ; } catch ( org.ovirt.engine.core.common.errors.EngineException ex ) { org.mockito.Mockito.verify ( auditLogDirector , org.mockito.Mockito.times ( 3 ) ) . log ( org.mockito.ArgumentMatchers.any ( ) , org.mockito.ArgumentMatchers.any ( ) ) ; } }
Source:
public void testCanEditARunningVM ( ) { prepareVmToPassValidate ( ) ; vm.setStatus ( VMStatus.Up ) ; mockDiskDaoGetAllForVm ( java.util.Collections.emptyList ( ) , true ) ; mockVmValidator ( ) ; org.mockito.Mockito.doReturn ( vmDeviceDao ) . when ( command ) . getVmDeviceDao ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areUpdatedFieldsLegal ( ) ; command.initEffectiveCompatibilityVersion ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }

Target:
public void testCanEditARunningVM ( ) { prepareVmToPassValidate ( ) ; vm.setStatus ( VMStatus.Up ) ; mockDiskDaoGetAllForVm ( java.util.Collections.emptyList ( ) , true ) ; mockVmValidator ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( command ) . areUpdatedFieldsLegal ( ) ; command.initEffectiveCompatibilityVersion ( ) ; org.ovirt.engine.core.bll.ValidateTestUtils.runAndAssertValidateSuccess ( command ) ; }
Source:
public void setVmIdOnVfs ( org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.compat.Guid vmId , final java.util.Set < java.lang.String > vfsNames ) { java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > hostDevices = hostDeviceDao.getHostDevicesByHostId ( hostId ) ; java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > vfs = org.ovirt.engine.core.utils.linq.LinqUtils.filter ( hostDevices , new org.ovirt.engine.core.utils.linq.Predicate < org.ovirt.engine.core.common.businessentities.HostDevice > ( ) { @ java.lang.Override public boolean eval ( org.ovirt.engine.core.common.businessentities.HostDevice device ) { return ( vfsNames.contains ( device.getDeviceName ( ) ) ) && ( isVf ( device ) ) ; } } ) ; setVmIdOnVfsDevices ( hostId , vmId , new java.util.HashSet ( vfs ) ) ; }

Target:
public void setVmIdOnVfs ( org.ovirt.engine.core.compat.Guid hostId , org.ovirt.engine.core.compat.Guid vmId , final java.util.Set < java.lang.String > vfsNames ) { java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > hostDevices = hostDeviceDao.getHostDevicesByHostId ( hostId ) ; java.util.List < org.ovirt.engine.core.common.businessentities.HostDevice > vfs = org.ovirt.engine.core.utils.linq.LinqUtils.filter ( hostDevices , new org.ovirt.engine.core.utils.linq.Predicate < org.ovirt.engine.core.common.businessentities.HostDevice > ( ) { @ java.lang.Override public boolean eval ( org.ovirt.engine.core.common.businessentities.HostDevice device ) { return ( vfsNames.contains ( device.getDeviceName ( ) ) ) && ( isVf ( device ) ) ; } } ) ; setVmIdOnVfsDevices ( vmId , new java.util.HashSet ( vfs ) ) ; }
Source:
private static java.lang.String getDiskLabelList ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.Disk > disks ) { if ( disks.isEmpty ( ) ) { return null ; } final java.util.List < java.lang.String > labels = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.Disk disk : disks ) { labels.add ( disk.getDiskAlias ( ) ) ; } return org.ovirt.engine.ui.uicompat.external.StringUtils.join ( labels , ", " ) ; }

Target:
public static java.lang.String getDiskLabelList ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage.Disk > disks ) { if ( disks.isEmpty ( ) ) { return null ; } final java.util.List < java.lang.String > labels = new java.util.ArrayList < > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage.Disk disk : disks ) { labels.add ( disk.getDiskAlias ( ) ) ; } return org.ovirt.engine.ui.uicompat.external.StringUtils.join ( labels , ", " ) ; }
Source:
private java.util.List < org.ovirt.engine.api.model.LogicalUnit > getIncomingLuns ( org.ovirt.engine.api.model.Storage storage ) { return ! ( storage.getLogicalUnits ( ) . isEmpty ( ) ) ? storage.getLogicalUnits ( ) : storage.getVolumeGroup ( ) . getLogicalUnits ( ) ; }

Target:
private java.util.List < org.ovirt.engine.api.model.LogicalUnit > getIncomingLuns ( org.ovirt.engine.api.model.Storage storage ) { if ( storage.getLogicalUnits ( ) . isEmpty ( ) ) { if ( ( storage.getVolumeGroup ( ) ) != null ) { return storage.getVolumeGroup ( ) . getLogicalUnits ( ) ; } else { return new java.util.ArrayList < org.ovirt.engine.api.model.LogicalUnit > ( ) ; } } else { return storage.getLogicalUnits ( ) ; } }
Source:
private void verifyCapabilities ( org.ovirt.engine.api.model.Capabilities capabilities ) { assertNotNull ( capabilities ) ; assertEquals ( 2 , capabilities.getVersions ( ) . size ( ) ) ; verifyVersion ( capabilities.getVersions ( ) . get ( 0 ) , 1 , 5 , false , "bar" , 0 , false , false , false ) ; verifyVersion ( capabilities.getVersions ( ) . get ( 1 ) , 10 , 3 , true , "foo" , 15 , true , true , true ) ; verifyPermits ( capabilities ) ; verifySchedulingPolicies ( capabilities ) ; }

Target:
private void verifyCapabilities ( org.ovirt.engine.api.model.Capabilities capabilities ) { assertNotNull ( capabilities ) ; assertEquals ( 2 , capabilities.getVersions ( ) . size ( ) ) ; verifyVersion ( capabilities.getVersions ( ) . get ( 0 ) , 1 , 5 , false , "bar" , 0 , false , false , false ) ; verifyVersion ( capabilities.getVersions ( ) . get ( 1 ) , 10 , 3 , true , "foo" , 15 , true , true , true ) ; }
Source:
public void testSelfAndIdentifyEquality ( ) { org.ovirt.engine.core.compat.Guid vmId = org.ovirt.engine.core.compat.Guid.createGuidFromString ( "b23ad6d7-0df8-4d69-b4e5-d5b5e90c2463" ) ; org.ovirt.engine.core.compat.Guid deviceId = org.ovirt.engine.core.compat.Guid.createGuidFromString ( "b23ad6d7-0df8-4d69-b4e5-d5b5e90c2464" ) ; org.ovirt.engine.core.common.businessentities.VmDevice device1 = createVmDevice ( deviceId , vmId ) ; org.junit.Assert.assertTrue ( ( ( device1.compareTo ( device1 ) ) == 0 ) ) ; org.ovirt.engine.core.common.businessentities.VmDevice device2 = createVmDevice ( deviceId , vmId ) ; org.junit.Assert.assertTrue ( ( ( device1.compareTo ( device2 ) ) == 0 ) ) ; }

Target:
public void testSelfAndIdentifyEquality ( ) { org.ovirt.engine.core.compat.Guid vmId = new org.ovirt.engine.core.compat.Guid ( "b23ad6d7-0df8-4d69-b4e5-d5b5e90c2463" ) ; org.ovirt.engine.core.compat.Guid deviceId = new org.ovirt.engine.core.compat.Guid ( "b23ad6d7-0df8-4d69-b4e5-d5b5e90c2464" ) ; org.ovirt.engine.core.common.businessentities.VmDevice device1 = createVmDevice ( deviceId , vmId ) ; org.junit.Assert.assertTrue ( ( ( device1.compareTo ( device1 ) ) == 0 ) ) ; org.ovirt.engine.core.common.businessentities.VmDevice device2 = createVmDevice ( deviceId , vmId ) ; org.junit.Assert.assertTrue ( ( ( device1.compareTo ( device2 ) ) == 0 ) ) ; }
Source:
public void render ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.Context context , org.ovirt.engine.core.common.businessentities.VmTemplate template , com.google.gwt.safehtml.shared.SafeHtmlBuilder sb ) { sb.append ( templates.vmNameCellItem ( org.ovirt.engine.ui.common.utils.ElementIdUtils.createTableCellElementId ( elementIdPrefix , "name" , context ) , template.getName ( ) ) ) ; java.lang.String description = template.getDescription ( ) ; if ( ( description != null ) && ( ! ( description.isEmpty ( ) ) ) ) { sb.append ( templates.vmDescriptionCellItem ( description ) ) ; } }

Target:
public void render ( org.ovirt.engine.ui.userportal.section.main.view.tab.extended.Context context , org.ovirt.engine.core.common.businessentities.VmTemplate template , com.google.gwt.safehtml.shared.SafeHtmlBuilder sb ) { sb.append ( templates.vmNameCellItem ( org.ovirt.engine.ui.common.utils.ElementIdUtils.createTableCellElementId ( elementIdPrefix , "name" , context ) , template.getName ( ) ) ) ; }
Source:
private void doProviderSearch ( ) { org.ovirt.engine.ui.frontend.AsyncQuery providersQuery = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; providersQuery.setModel ( this ) ; providersQuery.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { setProviders ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > ) ( returnValue ) ) ) ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getAllProviders ( providersQuery ) ; }

Target:
private void doProviderSearch ( ) { org.ovirt.engine.ui.frontend.AsyncQuery providersQuery = new org.ovirt.engine.ui.frontend.AsyncQuery ( ) ; providersQuery.setModel ( this ) ; providersQuery.asyncCallback = new org.ovirt.engine.ui.frontend.INewAsyncCallback ( ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) @ java.lang.Override public void onSuccess ( java.lang.Object model , java.lang.Object returnValue ) { setProviders ( ( ( java.util.List < org.ovirt.engine.core.common.businessentities.Provider > ) ( returnValue ) ) ) ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance ( ) . getAllProviders ( providersQuery ) ; }
Source:
private void addVideoCardByDisplayType ( org.ovirt.engine.core.common.businessentities.DisplayType displayType ) { org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct struct = new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcStruct ( ) ; struct.add ( VdsProperties.Type , VmDeviceType.VIDEO.getName ( ) ) ; struct.add ( VdsProperties.Device , displayType.getVmDeviceType ( ) . getName ( ) ) ; struct.add ( VdsProperties.SpecParams , org.ovirt.engine.core.vdsbroker.vdsbroker.VmInfoBuilder.getNewMonitorSpecParams ( ) ) ; struct.add ( VdsProperties.DeviceId , java.lang.String.valueOf ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ) ; devices.add ( struct ) ; }

Target:
private void addVideoCardByDisplayType ( org.ovirt.engine.core.common.businessentities.DisplayType displayType ) { java.util.Map < java.lang.String , java.lang.Object > struct = new java.util.HashMap < java.lang.String , java.lang.Object > ( ) ; struct.put ( VdsProperties.Type , VmDeviceType.VIDEO.getName ( ) ) ; struct.put ( VdsProperties.Device , displayType.getVmDeviceType ( ) . getName ( ) ) ; struct.put ( VdsProperties.SpecParams , org.ovirt.engine.core.vdsbroker.vdsbroker.VmInfoBuilder.getNewMonitorSpecParams ( ) ) ; struct.put ( VdsProperties.DeviceId , java.lang.String.valueOf ( org.ovirt.engine.core.compat.Guid.NewGuid ( ) ) ) ; devices.add ( struct ) ; }
Source:
private boolean validateNetworkProviderConfiguration ( ) { return ( ( ! ( org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . isInstallHost ( ) ) ) || ( ( org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . getVdsStaticData ( ) . getOpenstackNetworkProviderId ( ) ) == null ) ) || ( validateOpenstackNetworkProviderProperties ( org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . getVdsStaticData ( ) . getOpenstackNetworkProviderId ( ) , org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . getNetworkMappings ( ) ) ) ; }

Target:
private boolean validateNetworkProviderConfiguration ( ) { return ( ! ( org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . isInstallHost ( ) ) ) || ( super . validateNetworkProviderConfiguration ( org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . getVdsStaticData ( ) . getOpenstackNetworkProviderId ( ) , org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand.getParameters ( ) . getNetworkMappings ( ) ) ) ; }
Source:
public void commandSucceeds ( ) { command = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeGeoRepSessionCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters ( masterVolumeId , slaveVolumeName , org.ovirt.engine.core.compat.Guid.newGuid ( ) , null , null , false ) , null ) ) ; prepareMocks ( ) ; org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeGeoRepSessionCommandTest.SUPPORTED_VERSION ) . when ( cluster ) . getCompatibilityVersion ( ) ; org.mockito.Mockito.doReturn ( volume ) . when ( command ) . getSlaveVolume ( ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getSlaveHost ( ) ; org.junit.Assert.assertTrue ( command.validate ( ) ) ; }

Target:
public void commandSucceeds ( ) { org.mockito.Mockito.doReturn ( org.ovirt.engine.core.bll.gluster.CreateGlusterVolumeGeoRepSessionCommandTest.SUPPORTED_VERSION ) . when ( cluster ) . getCompatibilityVersion ( ) ; org.mockito.Mockito.doReturn ( volume ) . when ( command ) . getSlaveVolume ( ) ; org.mockito.Mockito.doReturn ( vds ) . when ( command ) . getSlaveHost ( ) ; org.junit.Assert.assertTrue ( command.validate ( ) ) ; }
Source:
public void testClusterNetworkLinks ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.NETWORK_ID ) ; network.setCluster ( new org.ovirt.engine.api.model.Cluster ( ) ) ; network.getCluster ( ) . setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.CLUSTER_ID ) ; org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( setUpUriExpectations ( ) , network ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.CLUSTER_NETWORK_HREF , network.getHref ( ) ) ; }

Target:
public void testClusterNetworkLinks ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Network network = new org.ovirt.engine.api.model.Network ( ) ; network.setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.NETWORK_ID ) ; network.setCluster ( new org.ovirt.engine.api.model.Cluster ( ) ) ; network.getCluster ( ) . setId ( org.ovirt.engine.api.restapi.util.LinkHelperTest.CLUSTER_ID ) ; org.ovirt.engine.api.restapi.util.LinkHelper.addLinks ( network ) ; assertEquals ( org.ovirt.engine.api.restapi.util.LinkHelperTest.CLUSTER_NETWORK_HREF , network.getHref ( ) ) ; }
Source:
public void testAddIncompleteParametersNoPermits ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Role model = new org.ovirt.engine.api.model.Role ( ) ; 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 , "Role" , "add" , "permits.id" ) ; } }

Target:
public void testAddIncompleteParametersNoPermits ( ) throws java.lang.Exception { org.ovirt.engine.api.model.Role model = new org.ovirt.engine.api.model.Role ( ) ; model.setName ( NAMES [ 0 ] ) ; setUriInfo ( setUpBasicUriExpectations ( ) ) ; try { collection.add ( model ) ; fail ( "expected WebApplicationException on incomplete parameters" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyIncompleteException ( wae , "Role" , "add" , "permits.id" ) ; } }
Source:
public void testNetworksOnNicMatchMtuWhenNoNetworksAreProvided ( ) throws java.lang.Exception { java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > > networksOnNics = java.util.Collections.singletonMap ( "nicName" , java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.Network > emptyList ( ) ) ; org.ovirt.engine.core.bll.network.host.NetworkMtuValidator networkMtuValidator = new org.ovirt.engine.core.bll.network.host.NetworkMtuValidator ( new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( java.util.Collections.< org.ovirt.engine.core.common.businessentities.network.Network > emptyList ( ) ) ) ; org.junit.Assert.assertThat ( networkMtuValidator.validateMtu ( networksOnNics ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }

Target:
public void testNetworksOnNicMatchMtuWhenNoNetworksAreProvided ( ) throws java.lang.Exception { java.util.Map < java.lang.String , java.util.List < org.ovirt.engine.core.common.businessentities.network.Network > > networksOnNics = java.util.Collections.singletonMap ( "nicName" , java.util.Collections.emptyList ( ) ) ; org.ovirt.engine.core.bll.network.host.NetworkMtuValidator networkMtuValidator = new org.ovirt.engine.core.bll.network.host.NetworkMtuValidator ( new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( java.util.Collections.emptyList ( ) ) ) ; org.junit.Assert.assertThat ( networkMtuValidator.validateMtu ( networksOnNics ) , org.ovirt.engine.core.bll.validator.ValidationResultMatchers.isValid ( ) ) ; }
Source:
private void mockDAOForQuery ( ) { org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmTemplateDao ( ) ) . thenReturn ( vmTemplateDAO ) ; returnedVmTemplates = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > ( ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getQuotaId ( ) ) . thenReturn ( quotaId ) ; org.mockito.Mockito.when ( vmTemplateDAO.getAllTemplatesRelatedToQuotaId ( quotaId ) ) . thenReturn ( returnedVmTemplates ) ; }

Target:
private void mockDAOForQuery ( ) { org.mockito.Mockito.when ( getDbFacadeMockInstance ( ) . getVmTemplateDao ( ) ) . thenReturn ( vmTemplateDAO ) ; returnedVmTemplates = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.VmTemplate > ( ) ; org.mockito.Mockito.when ( getQueryParameters ( ) . getId ( ) ) . thenReturn ( quotaId ) ; org.mockito.Mockito.when ( vmTemplateDAO.getAllTemplatesRelatedToQuotaId ( quotaId ) ) . thenReturn ( returnedVmTemplates ) ; }
Source:
public void unsupportedHostedEngineDeployWhenClusterLevelIsUnsupported ( ) { org.mockito.Mockito.when ( hostedEngineHelper.isVmManaged ( ) ) . thenReturn ( false ) ; mockCluster ( Version.v3_6 ) ; 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_HOSTED_ENGINE_DEPLOYMENT_UNSUPPORTED ) ) ; }

Target:
public void unsupportedHostedEngineDeployWhenClusterLevelIsUnsupported ( ) { mockCluster ( Version.v3_6 ) ; 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_HOSTED_ENGINE_DEPLOYMENT_UNSUPPORTED ) ) ; }
Source:
public void shouldDetectPassThroughDeviceOnVM ( ) { org.mockito.Mockito.when ( hostDeviceManager.checkVmNeedsDirectPassthrough ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( true ) ; org.assertj.core.api.Assertions.assertThat ( validator.checkVmReadyForUpgrade ( invalidVM ) ) . contains ( EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NEEDS_PASSTHROUGH.name ( ) ) ; }

Target:
public void shouldDetectPassThroughDeviceOnVM ( ) { org.mockito.Mockito.when ( hostDeviceManager.checkVmNeedsDirectPassthrough ( org.mockito.ArgumentMatchers.any ( ) ) ) . thenReturn ( true ) ; org.assertj.core.api.Assertions.assertThat ( validator.checkVmReadyForUpgrade ( invalidVM ) ) . contains ( EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NEEDS_PASSTHROUGH.name ( ) ) ; }
Source:
protected java.lang.String getText ( org.ovirt.engine.core.common.utils.Pair < java.lang.Boolean , org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration > entity ) { return ( entity.getSecond ( ) . getDescription ( ) ) == null ? constants.notAvailableLabel ( ) : entity.getSecond ( ) . getDescription ( ) ; }

Target:
public java.lang.String getValue ( org.ovirt.engine.ui.uicommonweb.models.EntityModel < org.ovirt.engine.core.common.utils.Pair < java.lang.Boolean , org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration > > object ) { return ( object.getEntity ( ) . getSecond ( ) . getDescription ( ) ) == null ? constants.notAvailableLabel ( ) : object.getEntity ( ) . getSecond ( ) . getDescription ( ) ; }
Source:
public void diskImagesAlreadyExistBothExist ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) . when ( validator ) . getExistingDisk ( org.mockito.ArgumentMatchers.any ( org.ovirt.engine.core.compat.Guid.class ) ) ; org.junit.Assert.assertThat ( validator.diskImagesAlreadyExist ( ) , org.hamcrest.CoreMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST ) ) . and ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.replacements ( org.hamcrest.CoreMatchers.hasItem ( org.ovirt.engine.core.bll.validator.storage.DiskImagesValidatorTest.createAliasReplacements ( disk1 , disk2 ) ) ) ) ) ; }

Target:
public void diskImagesAlreadyExistBothExist ( ) { org.mockito.Mockito.doReturn ( new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ) . when ( validator ) . getExistingDisk ( org.mockito.ArgumentMatchers.any ( ) ) ; org.junit.Assert.assertThat ( validator.diskImagesAlreadyExist ( ) , org.hamcrest.CoreMatchers.both ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.failsWith ( EngineMessage.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST ) ) . and ( org.ovirt.engine.core.bll.validator.ValidationResultMatchers.replacements ( org.hamcrest.CoreMatchers.hasItem ( org.ovirt.engine.core.bll.validator.storage.DiskImagesValidatorTest.createAliasReplacements ( disk1 , disk2 ) ) ) ) ) ; }