auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public org.ovirt.engine.api.resource.NetworkResource getNetworkResource ( java.lang.String id ) { return inject ( new org.ovirt.engine.api.restapi.resource.BackendIscsiBondNetworkResource ( id , this ) ) ; }

Target:
public javax.ws.rs.core.Response add ( org.ovirt.engine.api.model.Network network ) { org.ovirt.engine.api.model.Network entity = map ( network ) ; org.ovirt.engine.core.compat.Guid networkId = entity.getId ( ) ; org.ovirt.engine.core.common.businessentities.IscsiBond bond = getBond ( ) ; bond.getNetworkIds ( ) . add ( networkId ) ; return performCreate ( VdcActionType.EditIscsiBond , new org.ovirt.engine.core.common.action.EditIscsiBondParameters ( bond ) , new org.ovirt.engine.api.restapi.resource.BackendIscsiBondNetworksResource.AddedNetworkResolver ( networkId ) ) ; }
Source:
public void testIsNotLocalFsWithDefaultClusterWhenClusterIsDefault ( ) { storagePool.setstorage_pool_type ( StorageType.LOCALFS ) ; org.mockito.Mockito.doReturn ( true ) . when ( validator ) . containsDefaultCluster ( ) ; org.ovirt.engine.core.bll.ValidationResult result = validator.isNotLocalfsWithDefaultCluster ( ) ; org.junit.Assert.assertFalse ( result.isValid ( ) ) ; org.ovirt.engine.core.bll.storage.StoragePoolValidatorTest.assertMessage ( result , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_VDS_GROUP_CANNOT_BE_LOCALFS ) ; }

Target:
public void testIsNotLocalFsWithDefaultClusterWhenClusterIsDefault ( ) { storagePool.setStorageType ( StorageType.LOCALFS ) ; org.mockito.Mockito.doReturn ( true ) . when ( validator ) . containsDefaultCluster ( ) ; org.ovirt.engine.core.bll.ValidationResult result = validator.isNotLocalfsWithDefaultCluster ( ) ; org.junit.Assert.assertFalse ( result.isValid ( ) ) ; org.ovirt.engine.core.bll.storage.StoragePoolValidatorTest.assertMessage ( result , VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_VDS_GROUP_CANNOT_BE_LOCALFS ) ; }
Source:
public void failWhenHostDoesNotExist ( ) { java.util.List < java.lang.String > messages = new java.util.LinkedList < > ( ) ; boolean result = validator.isHostExists ( null , messages ) ; org.junit.Assert.assertFalse ( result ) ; org.junit.Assert.assertEquals ( 1 , messages.size ( ) ) ; org.junit.Assert.assertEquals ( "ACTION_TYPE_FAILED_HOST_NOT_EXIST" , messages.get ( 0 ) ) ; }

Target:
public void failWhenHostDoesNotExist ( ) { java.util.List < java.lang.String > messages = new java.util.LinkedList < > ( ) ; boolean result = validator.isHostExists ( null , messages ) ; org.junit.jupiter.api.Assertions.assertFalse ( result ) ; org.junit.jupiter.api.Assertions.assertEquals ( 1 , messages.size ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( "ACTION_TYPE_FAILED_HOST_NOT_EXIST" , messages.get ( 0 ) ) ; }
Source:
public static void GetSpiceUsbAutoShare ( 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.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SpiceUsbAutoShare , org.ovirt.engine.core.common.config.Config.DefaultConfigurationVersion ) , aQuery ) ; }

Target:
public static void GetSpiceUsbAutoShare ( 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.Boolean ) ( source ) ) . booleanValue ( ) : true ; } } ; org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.GetConfigFromCache ( new org.ovirt.engine.core.common.queries.GetConfigurationValueParameters ( org.ovirt.engine.core.common.queries.ConfigurationValues.SpiceUsbAutoShare , org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getDefaultConfigurationVersion ( ) ) , aQuery ) ; }
Source:
public void testDontFailWithNullValueEntitiesList ( ) { org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.BusinessEntityMapTest.TestItem > map = new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( null ) ; org.junit.Assert.assertThat ( map.get ( "anyString" ) , org.hamcrest.CoreMatchers.nullValue ( ) ) ; org.junit.Assert.assertThat ( map.get ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) , org.hamcrest.CoreMatchers.nullValue ( ) ) ; }

Target:
public void testDontFailWithNullValueEntitiesList ( ) { org.ovirt.engine.core.common.businessentities.BusinessEntityMap < org.ovirt.engine.core.common.businessentities.BusinessEntityMapTest.TestItem > map = new org.ovirt.engine.core.common.businessentities.BusinessEntityMap ( null ) ; org.hamcrest.MatcherAssert.assertThat ( map.get ( "anyString" ) , org.hamcrest.CoreMatchers.nullValue ( ) ) ; org.hamcrest.MatcherAssert.assertThat ( map.get ( org.ovirt.engine.core.compat.Guid.newGuid ( ) ) , org.hamcrest.CoreMatchers.nullValue ( ) ) ; }
Source:
public void showItem ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel < ? > item , org.ovirt.engine.ui.webadmin.section.main.view.popup.host.panels.NetworkItemPanel panel ) { if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel ) { showNetwork ( ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel ) ( item ) ) ) ; } else if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel ) { showNic ( ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel ) ( item ) ) ) ; } else if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel ) { return ; } showRelativeTo ( panel ) ; }

Target:
public java.lang.String getTooltipContent ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel < ? > item , org.ovirt.engine.ui.webadmin.section.main.view.popup.host.panels.NetworkItemPanel panel ) { if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel ) { showNetwork ( ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel ) ( item ) ) ) ; } else if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel ) { showNic ( ( ( org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel ) ( item ) ) ) ; } else if ( item instanceof org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel ) { return null ; } return this . getElement ( ) . getInnerHTML ( ) ; }
Source:
protected void executeVdsBrokerCommand ( ) { status = org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.getBroker ( ) . migrateStatus ( org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.getParameters ( ) . getVmId ( ) . toString ( ) ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.proceedProxyReturnValue ( ) ; }

Target:
protected void executeVdsBrokerCommand ( ) { org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusReturnForXmlRpc retVal = org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.getBroker ( ) . migrateStatus ( org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.getParameters ( ) . getVmId ( ) . toString ( ) ) ; status = retVal.getStatus ( ) ; setReturnValue ( retVal.getDowntime ( ) ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.MigrateStatusVDSCommand.proceedProxyReturnValue ( ) ; }
Source:
public void setItems ( java.util.Collection < T > value ) { if ( ( items ) != value ) { itemsChanging ( value , items ) ; items = value ; itemsChanged ( ) ; getItemsChangedEvent ( ) . raise ( this , EventArgs.EMPTY ) ; onPropertyChanged ( new org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ( "Items" ) ) ; } }

Target:
protected void itemsChanged ( T selectedItem ) { if ( selectedItem == null ) { itemsChanged ( ) ; } else { java.util.List < T > selectedItems = new java.util.ArrayList < T > ( ) ; selectedItems.add ( selectedItem ) ; setSelectedItem ( selectedItem ) ; setSelectedItems ( selectedItems ) ; } }
Source:
public javax.ws.rs.core.Response remove ( org.ovirt.engine.api.model.Action action ) { get ( ) ; org.ovirt.engine.core.common.action.RemoveDiskParameters params = new org.ovirt.engine.core.common.action.RemoveDiskParameters ( asGuid ( id ) ) ; if ( action.isSetForce ( ) ) { params.setForceDelete ( action.isForce ( ) ) ; } if ( ( action.isSetStorageDomain ( ) ) && ( action.getStorageDomain ( ) . isSetId ( ) ) ) { params.setStorageDomainId ( asGuid ( action.getStorageDomain ( ) . getId ( ) ) ) ; } return performAction ( VdcActionType.RemoveDisk , params ) ; }

Target:
public javax.ws.rs.core.Response remove ( ) { get ( ) ; org.ovirt.engine.core.common.action.RemoveDiskParameters params = new org.ovirt.engine.core.common.action.RemoveDiskParameters ( asGuid ( id ) ) ; boolean force = org.ovirt.engine.api.common.util.QueryHelper.getBooleanMatrixParameter ( uriInfo , org.ovirt.engine.api.restapi.resource.BackendTemplateDiskResource.FORCE , true , false ) ; if ( force ) { params.setForceDelete ( force ) ; } java.lang.String storageDomain = org.ovirt.engine.api.common.util.QueryHelper.getMatrixConstraint ( uriInfo , org.ovirt.engine.api.restapi.resource.BackendTemplateDiskResource.STORAGE_DOMAIN ) ; if ( storageDomain != null ) { params.setStorageDomainId ( asGuid ( storageDomain ) ) ; } return performAction ( VdcActionType.RemoveDisk , params ) ; }
Source:
public static java.lang.String map ( org.ovirt.engine.api.model.VmPoolType vmPoolType , java.lang.String incoming ) { if ( vmPoolType == null ) { return null ; } switch ( vmPoolType ) { case AUTOMATIC : return VmPoolType.AUTOMATIC.value ( ) ; case MANUAL : return VmPoolType.MANUAL.value ( ) ; default : return null ; } }

Target:
public static org.ovirt.engine.api.model.VmPoolType map ( org.ovirt.engine.api.model.VmPoolType vmPoolType , org.ovirt.engine.api.model.VmPoolType incoming ) { if ( vmPoolType == null ) { return null ; } switch ( vmPoolType ) { case AUTOMATIC : return org.ovirt.engine.api.model.VmPoolType.AUTOMATIC ; case MANUAL : return org.ovirt.engine.api.model.VmPoolType.MANUAL ; default : return null ; } }
Source:
public void shouldDetectPassThroughDeviceOnVM ( ) { org.mockito.Mockito.when ( hostDeviceManager.checkVmNeedsDirectPassthrough ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( true ) ; org.hamcrest.MatcherAssert.assertThat ( validator.checkVmReadyForUpgrade ( invalidVM ) , org.hamcrest.CoreMatchers.hasItem ( UPGRADE_ERROR.VM_NEEDS_PASSTHROUGH ) ) ; }

Target:
public void shouldDetectPassThroughDeviceOnVM ( ) { org.mockito.Mockito.when ( hostDeviceManager.checkVmNeedsDirectPassthrough ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.VM.class ) ) ) . thenReturn ( true ) ; org.hamcrest.MatcherAssert.assertThat ( validator.checkVmReadyForUpgrade ( invalidVM ) , org.hamcrest.CoreMatchers.hasItem ( EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NEEDS_PASSTHROUGH.name ( ) ) ) ; }
Source:
protected void doGet ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response ) throws java.io.IOException , javax.servlet.ServletException { java.io.File file = org.ovirt.engine.core.utils.servlet.ServletUtils.makeFileFromSanePath ( request.getPathInfo ( ) , base ) ; file = checkForIndex ( request , response , file , request.getPathInfo ( ) ) ; org.ovirt.engine.core.utils.servlet.ServletUtils.sendFile ( request , response , file , type , cache ) ; }

Target:
protected void doGet ( javax.servlet.http.HttpServletRequest request , javax.servlet.http.HttpServletResponse response ) throws java.io.IOException , javax.servlet.ServletException { java.io.File file = org.ovirt.engine.core.utils.servlet.ServletUtils.makeFileFromSanePath ( request.getPathInfo ( ) , base ) ; file = checkForIndex ( request , response , file , request.getPathInfo ( ) ) ; org.ovirt.engine.core.utils.servlet.ServletUtils.sendFile ( request , response , file , type , cache , required ) ; }
Source:
public org.ovirt.engine.sdk.entities.Response delete ( org.ovirt.engine.sdk.entities.Action action , java.lang.Boolean async , java.lang.String correlationId ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = this . getHref ( ) ; java.util.List < org.apache.http.Header > headers = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) . add ( "Correlation-Id" , correlationId ) . build ( ) ; url = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) . add ( "async" , async , UrlParameterType.MATRIX ) . build ( ) ; return getProxy ( ) . delete ( url , action , org.ovirt.engine.sdk.entities.Action.class , org.ovirt.engine.sdk.entities.Response.class , headers ) ; }

Target:
public org.ovirt.engine.sdk.entities.Action forceselectspm ( org.ovirt.engine.sdk.entities.Action action ) throws java.io.IOException , org.apache.http.client.ClientProtocolException , org.ovirt.engine.sdk.exceptions.ServerException { java.lang.String url = ( this . getHref ( ) ) + "/forceselectspm" ; org.ovirt.engine.sdk.utils.HttpHeaderBuilder headersBuilder = new org.ovirt.engine.sdk.utils.HttpHeaderBuilder ( ) ; java.util.List < org.apache.http.Header > headers = headersBuilder.build ( ) ; org.ovirt.engine.sdk.utils.UrlBuilder urlBuilder = new org.ovirt.engine.sdk.utils.UrlBuilder ( url ) ; url = urlBuilder.build ( ) ; return getProxy ( ) . action ( url , action , org.ovirt.engine.sdk.entities.Action.class , org.ovirt.engine.sdk.entities.Action.class , headers ) ; }
Source:
public void eventRaised ( org.ovirt.engine.ui.uicompat.Event ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.EventArgs args ) { java.lang.String propName = ( ( org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs ) ( args ) ) . propertyName ; if ( ! ( "IsPowerManagementTabSelected" . equals ( propName ) ) ) { return ; } if ( model.getIsPowerManagementTabSelected ( ) ) { getView ( ) . showPowerManagement ( ) ; } }

Target:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { if ( ( ( org.ovirt.engine.ui.webadmin.section.main.view.popup.host.HostPopupView ) ( getView ( ) ) ) . rbDiscoveredHost.getValue ( ) ) { model.getIsDiscorveredHosts ( ) . setEntity ( true ) ; } }
Source:
public static VdsNetworkInterface.NetworkImplementationDetails calculateNetworkImplementationDetails ( org.ovirt.engine.core.common.businessentities.network.Network network , org.ovirt.engine.core.common.businessentities.network.HostNetworkQos hostNetworkQos , org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface iface ) { if ( org.apache.commons.lang.StringUtils.isEmpty ( iface.getNetworkName ( ) ) ) { return null ; } if ( network != null ) { if ( new org.ovirt.engine.core.utils.NetworkInSyncWithVdsNetworkInterface ( iface , network , hostNetworkQos ) . isNetworkInSync ( ) ) { return new org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails ( true , true ) ; } else { return new org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails ( false , true ) ; } } else { return new org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails ( ) ; } }

Target:
public static boolean qosConfiguredOnInterface ( org.ovirt.engine.core.common.businessentities.network.NetworkAttachment networkAttachment , org.ovirt.engine.core.common.businessentities.network.Network network ) { if ( ( networkAttachment != null ) && ( networkAttachment.isQosOverridden ( ) ) ) { return ( ( networkAttachment.getHostNetworkQos ( ) ) != null ) && ( ! ( networkAttachment.getHostNetworkQos ( ) . isEmpty ( ) ) ) ; } else { return ( network != null ) && ( ( network.getQosId ( ) ) != null ) ; } }
Source:
protected void convert ( ) { boolean useVirtV2V = ( org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand.getParameters ( ) . getVm ( ) . getOrigin ( ) ) != ( org.ovirt.engine.core.common.businessentities.OriginType.OVIRT ) ; if ( useVirtV2V ) { runInternalActionWithTasksContext ( ActionType.ConvertOva , buildConvertOvaParameters ( ) ) ; } else { runInternalActionWithTasksContext ( ActionType.ExtractOva , buildExtractOvaParameters ( ) ) ; } }

Target:
protected void convert ( ) { boolean useVirtV2V = ( org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand.getParameters ( ) . getVm ( ) . getOrigin ( ) ) != ( org.ovirt.engine.core.common.businessentities.OriginType.OVIRT ) ; if ( useVirtV2V ) { runInternalAction ( ActionType.ConvertOva , buildConvertOvaParameters ( ) , createConversionStepContext ( StepEnum.CONVERTING_OVA ) ) ; } else { runInternalAction ( ActionType.ExtractOva , buildExtractOvaParameters ( ) , createConversionStepContext ( StepEnum.EXTRACTING_OVA ) ) ; } }
Source:
private org.ovirt.engine.core.common.businessentities.VM mockVm ( ) { org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm.setId ( vmId ) ; vm.setStoragePoolId ( spId ) ; vm.setStatus ( VMStatus.Down ) ; org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBaseMockUtils.mockVmDao ( spyCommand , vmDAO ) ; org.mockito.Mockito.when ( vmDAO.get ( vmId ) ) . thenReturn ( vm ) ; return vm ; }

Target:
private org.ovirt.engine.core.common.businessentities.VM mockVm ( ) { org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM ( ) ; vm.setId ( vmId ) ; vm.setStoragePoolId ( spId ) ; vm.setStatus ( VMStatus.Down ) ; org.mockito.Mockito.doReturn ( vmDAO ) . when ( spyCommand ) . getVmDAO ( ) ; org.mockito.Mockito.when ( vmDAO.get ( vmId ) ) . thenReturn ( vm ) ; return vm ; }
Source:
public void initialize ( ) { super . initialize ( ) ; org.ovirt.engine.ui.uicommonweb.UICommand onSaveCommand = new org.ovirt.engine.ui.uicommonweb.UICommand ( "OnSave" , this ) ; onSaveCommand.setTitle ( org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) . ok ( ) ) ; onSaveCommand.setIsDefault ( true ) ; getCommands ( ) . add ( onSaveCommand ) ; getCommands ( ) . add ( getCancelCommand ( ) ) ; updateClusters ( ) ; }

Target:
public void initialize ( ) { super . initialize ( ) ; org.ovirt.engine.ui.uicommonweb.UICommand onSaveCommand = org.ovirt.engine.ui.uicommonweb.UICommand.createDefaultOkUiCommand ( "OnSave" , this ) ; org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel.getCommands ( ) . add ( onSaveCommand ) ; org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel.getCommands ( ) . add ( getCancelCommand ( ) ) ; updateClusters ( ) ; }
Source:
private void migrationPoliciesChanged ( ) { boolean hasMigrationPolicy = ( ( getMigrationPolicies ( ) . getSelectedItem ( ) ) != null ) && ( ! ( NoMigrationPolicy.ID.equals ( getMigrationPolicies ( ) . getSelectedItem ( ) . getId ( ) ) ) ) ; org.ovirt.engine.ui.uicompat.UIConstants constants = org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) ; getAutoConverge ( ) . setIsChangeable ( ( ! hasMigrationPolicy ) , constants.availableOnlyWithNoMigrationPolicy ( ) ) ; getMigrateCompressed ( ) . setIsChangeable ( ( ! hasMigrationPolicy ) , constants.availableOnlyWithNoMigrationPolicy ( ) ) ; }

Target:
private void migrationPoliciesChanged ( ) { boolean hasMigrationPolicy = ( ( getMigrationPolicies ( ) . getSelectedItem ( ) ) != null ) && ( ! ( NoMigrationPolicy.ID.equals ( getMigrationPolicies ( ) . getSelectedItem ( ) . getId ( ) ) ) ) ; org.ovirt.engine.ui.uicompat.UIConstants constants = org.ovirt.engine.ui.uicompat.ConstantsManager.getInstance ( ) . getConstants ( ) ; getAutoConverge ( ) . setIsChangeable ( ( ! hasMigrationPolicy ) , constants.availableOnlyWithLegacyPolicy ( ) ) ; getMigrateCompressed ( ) . setIsChangeable ( ( ! hasMigrationPolicy ) , constants.availableOnlyWithLegacyPolicy ( ) ) ; }
Source:
protected boolean isDetachAllowed ( final boolean isRemoveLast ) { if ( ( getStoragePoolIsoMap ( ) ) == null ) { return failCanDoAction ( EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL ) ; } if ( ( ! isRemoveLast ) && ( isMaster ( ) ) ) { return failCanDoAction ( EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN ) ; } return true ; }

Target:
protected boolean isDetachAllowed ( final boolean isRemoveLast ) { if ( ( getStoragePoolIsoMap ( ) ) == null ) { return failValidation ( EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL ) ; } if ( ( ! isRemoveLast ) && ( isMaster ( ) ) ) { return failValidation ( EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN ) ; } return true ; }
Source:
private void addChildren ( org.ovirt.engine.core.common.businessentities.Tags tag ) { org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added to tree" , tag.gettag_name ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Tags > children = getTagDao ( ) . getAllForParent ( tag.gettag_id ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.Tags child : children ) { addChildren ( child ) ; org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added as child to parent '{}'" , child.gettag_name ( ) , tag.gettag_name ( ) ) ; tag.getChildren ( ) . add ( child ) ; addTagToHash ( tag ) ; addTagToHash ( child ) ; } }

Target:
private void addChildren ( org.ovirt.engine.core.common.businessentities.Tags tag ) { org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added to tree" , tag.getTagName ( ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.Tags > children = getTagDao ( ) . getAllForParent ( tag.getTagId ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.Tags child : children ) { addChildren ( child ) ; org.ovirt.engine.core.bll.TagsDirector.log.info ( "Tag '{}' added as child to parent '{}'" , child.getTagName ( ) , tag.getTagName ( ) ) ; tag.getChildren ( ) . add ( child ) ; addTagToHash ( tag ) ; addTagToHash ( child ) ; } }
Source:
private void waitUntilCheck ( java.util.function.Predicate < org.ovirt.vdsm.jsonrpc.client.JsonRpcClient > check , java.lang.String formatBefore , java.lang.String formatAfter ) throws java.lang.InterruptedException { java.lang.String hostname = client.getHostname ( ) ; org.ovirt.engine.core.vdsbroker.jsonrpc.JsonRpcVdsServer.logger.debug ( formatBefore , hostname ) ; int retries = 50 ; while ( check.test ( this . client ) ) { if ( retries == 0 ) { throw new org.ovirt.engine.core.vdsbroker.vdsbroker.VDSNetworkException ( ( ( "Unable to reconnect to " + hostname ) + " after policy reset" ) ) ; } retries -- ; java.util.concurrent.TimeUnit.MILLISECONDS.sleep ( 200 ) ; } org.ovirt.engine.core.vdsbroker.jsonrpc.JsonRpcVdsServer.logger.debug ( formatAfter , hostname ) ; }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.QemuImageInfoReturn getQemuImageInfo ( java.lang.String sdUUID , java.lang.String spUUID , java.lang.String imgUUID , java.lang.String volUUID ) { org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest request = new org.ovirt.vdsm.jsonrpc.client.RequestBuilder ( "Volume.getQemuImageInfo" ) . withParameter ( "storagepoolID" , spUUID ) . withParameter ( "storagedomainID" , sdUUID ) . withParameter ( "imageID" , imgUUID ) . withParameter ( "volumeID" , volUUID ) . build ( ) ; java.util.Map < java.lang.String , java.lang.Object > response = new org.ovirt.engine.core.vdsbroker.jsonrpc.FutureMap ( this . client , request ) ; return new org.ovirt.engine.core.vdsbroker.vdsbroker.QemuImageInfoReturn ( response ) ; }
Source:
public void testImportWithStorageDomainName ( ) throws java.lang.Exception { setUpGetEntityExpectations ( ( "Storage: name=" + ( NAMES [ 2 ] ) ) , SearchType.StorageDomain , getStorageDomain ( 2 ) ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setName ( NAMES [ 2 ] ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setId ( GUIDS [ 1 ] . toString ( ) ) ; doTestImport ( storageDomain , cluster , false ) ; }

Target:
public void testImportWithStorageDomainName ( ) throws java.lang.Exception { setUpEntityQueryExpectations ( VdcQueryType.GetStorageDomainByName , org.ovirt.engine.core.common.queries.NameQueryParameters.class , new java.lang.String [ ] { "Name" } , new java.lang.Object [ ] { NAMES [ 2 ] } , getStorageDomainStatic ( 2 ) ) ; setUpGetDataCenterByStorageDomainExpectations ( org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplateResourceTest.STORAGE_DOMAIN_ID ) ; org.ovirt.engine.api.model.StorageDomain storageDomain = new org.ovirt.engine.api.model.StorageDomain ( ) ; storageDomain.setName ( NAMES [ 2 ] ) ; org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster ( ) ; cluster.setId ( GUIDS [ 1 ] . toString ( ) ) ; doTestImport ( storageDomain , cluster , false ) ; }
Source:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand ( new org.ovirt.engine.core.common.action.gluster.GlusterHookStatusChangeParameters ( CLUSTER_ID , HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.mockito.Mockito.verify ( cmd , org.mockito.Mockito.atLeast ( 1 ) ) . addServerHookInDb ( org.mockito.Matchers.any ( org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook.class ) ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE ) ; }

Target:
public void executeCommand ( ) { cmd = org.mockito.Mockito.spy ( new org.ovirt.engine.core.bll.gluster.EnableGlusterHookCommand < org.ovirt.engine.core.common.action.gluster.GlusterHookParameters > ( new org.ovirt.engine.core.common.action.gluster.GlusterHookParameters ( HOOK_ID ) ) ) ; setupMocks ( cmd ) ; mockBackendStatusChange ( cmd , true ) ; cmd.executeCommand ( ) ; org.junit.Assert.assertEquals ( cmd.getAuditLogTypeValue ( ) , AuditLogType.GLUSTER_HOOK_ENABLE ) ; }
Source:
private java.util.List < org.ovirt.engine.api.model.RngSource > adaptRngSources ( org.ovirt.engine.api.v3.types.V3HardwareInformation from ) { java.util.List < org.ovirt.engine.api.model.RngSource > results = new java.util.LinkedList < > ( ) ; for ( java.lang.String s : from.getSupportedRngSources ( ) . getRngSources ( ) ) { results.add ( org.ovirt.engine.api.model.RngSource.valueOf ( s ) ) ; } return results ; }

Target:
private java.util.List < org.ovirt.engine.api.model.RngSource > adaptRngSources ( org.ovirt.engine.api.v3.types.V3HardwareInformation from ) { java.util.List < org.ovirt.engine.api.model.RngSource > results = new java.util.LinkedList < > ( ) ; for ( java.lang.String s : from.getSupportedRngSources ( ) . getRngSources ( ) ) { results.add ( org.ovirt.engine.api.model.RngSource.fromValue ( s ) ) ; } return results ; }
Source:
public void testGetAllByVdsGroup ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > result = dao.getAllByVdsGroup ( org.ovirt.engine.core.dao.VmStaticDaoTest.VDS_GROUP_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VmStatic vm : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.VmStaticDaoTest.VDS_GROUP_ID , vm.getVdsGroupId ( ) ) ; } }

Target:
public void testGetAllByCluster ( ) { java.util.List < org.ovirt.engine.core.common.businessentities.VmStatic > result = dao.getAllByCluster ( org.ovirt.engine.core.dao.VmStaticDaoTest.CLUSTER_ID ) ; org.junit.Assert.assertNotNull ( result ) ; org.junit.Assert.assertFalse ( result.isEmpty ( ) ) ; for ( org.ovirt.engine.core.common.businessentities.VmStatic vm : result ) { org.junit.Assert.assertEquals ( org.ovirt.engine.core.dao.VmStaticDaoTest.CLUSTER_ID , vm.getClusterId ( ) ) ; } }
Source:
public void testValidModifiedBonds_failsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Bond bond = new org.ovirt.engine.core.common.businessentities.network.Bond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; doTestValidModifiedBonds ( bond , ValidationResult.VALID , ValidationResult.VALID , null , false , false ) ; }

Target:
public void testValidModifiedBondsFailsWhenSlavesValidationFails ( ) throws java.lang.Exception { org.ovirt.engine.core.common.businessentities.network.Bond bond = createBond ( ) ; bond.setSlaves ( java.util.Arrays.asList ( "slaveA" , "slaveB" ) ) ; doTestValidModifiedBonds ( bond , ValidationResult.VALID , ValidationResult.VALID , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ) , new org.ovirt.engine.core.bll.ValidationResult ( org.ovirt.engine.core.common.errors.EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE ) ) ; }
Source:
protected void changeStorageDomainStatusInTransaction ( final org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap map , final org.ovirt.engine.core.common.businessentities.StorageDomainStatus status ) { executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap > ( ) { @ java.lang.Override public org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap runInTransaction ( ) { org.ovirt.engine.core.bll.context.CompensationContext context = getCompensationContext ( ) ; context.snapshotEntityStatus ( map , map.getstatus ( ) ) ; updateStatus ( map , status ) ; getCompensationContext ( ) . stateChanged ( ) ; return null ; } } ) ; }

Target:
protected void updateStorageDomain ( final java.util.List < org.ovirt.engine.core.common.businessentities.StorageDomain > storageDomainsToUpdate ) { executeInNewTransaction ( new org.ovirt.engine.core.utils.transaction.TransactionMethod < java.lang.Void > ( ) { @ java.lang.Override public java.lang.Void runInTransaction ( ) { for ( org.ovirt.engine.core.common.businessentities.StorageDomain domainToUpdate : storageDomainsToUpdate ) { org.ovirt.engine.core.bll.context.CompensationContext context = getCompensationContext ( ) ; context.snapshotEntity ( domainToUpdate.getStorageDynamicData ( ) ) ; getStorageDomainDynamicDao ( ) . update ( domainToUpdate.getStorageDynamicData ( ) ) ; getCompensationContext ( ) . stateChanged ( ) ; } return null ; } } ) ; }
Source:
public void OnSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > list = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > ( ) ; for ( org.ovirt.engine.core.common.businessentities.storage_pool a : ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.storage_pool > ) ( returnValue ) ) ) { if ( ( a.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StoragePoolStatus.Up ) ) { list.add ( a ) ; } } model.SetDataCenter ( model , list ) ; getPoolModelBehaviorInitializedEvent ( ) . raise ( this , EventArgs.Empty ) ; }

Target:
public void onSuccess ( java.lang.Object target , java.lang.Object returnValue ) { org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel model = ( ( org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel ) ( target ) ) ; java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > list = new java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ( ) ; for ( org.ovirt.engine.core.common.businessentities.StoragePool a : ( ( java.util.ArrayList < org.ovirt.engine.core.common.businessentities.StoragePool > ) ( returnValue ) ) ) { if ( ( a.getstatus ( ) ) == ( org.ovirt.engine.core.common.businessentities.StoragePoolStatus.Up ) ) { list.add ( a ) ; } } model.setDataCenter ( model , list ) ; getPoolModelBehaviorInitializedEvent ( ) . raise ( this , EventArgs.Empty ) ; }
Source:
public void canAddVm ( ) { org.mockito.Mockito.doNothing ( ) . when ( cmd ) . initTemplateDisks ( ) ; initCommandMethods ( ) ; cmd.init ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . validateCustomProperties ( org.mockito.ArgumentMatchers.any ( ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . validateSpaceRequirements ( ) ; org.junit.Assert.assertTrue ( "vm could not be added" , cmd.canAddVm ( java.util.Collections.singletonList ( createStorageDomain ( org.ovirt.engine.core.bll.STORAGE_DOMAIN_ID_1 ) ) ) ) ; }

Target:
public void canAddVm ( ) { org.mockito.Mockito.doNothing ( ) . when ( cmd ) . initTemplateDisks ( ) ; initCommandMethods ( ) ; cmd.init ( ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . validateCustomProperties ( org.mockito.ArgumentMatchers.any ( ) ) ; org.mockito.Mockito.doReturn ( true ) . when ( cmd ) . validateSpaceRequirements ( ) ; org.junit.jupiter.api.Assertions.assertTrue ( cmd.canAddVm ( java.util.Collections.singletonList ( createStorageDomain ( org.ovirt.engine.core.bll.STORAGE_DOMAIN_ID_1 ) ) ) , "vm could not be added" ) ; }
Source:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc setVmTicket ( java.lang.String vmId , java.lang.String otp64 , java.lang.String sec , java.lang.String connectionAction , java.util.Map < java.lang.String , java.lang.String > params ) { try { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.setVmTicket ( vmId , otp64 , sec , connectionAction , params ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; } catch ( java.lang.reflect.UndeclaredThrowableException ute ) { throw new org.ovirt.engine.core.vdsbroker.xmlrpc.XmlRpcRunTimeException ( ute ) ; } }

Target:
public org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc allocateVolume ( java.lang.String spUUID , java.lang.String sdUUID , java.lang.String imgGUID , java.lang.String volUUID , java.lang.String size ) { java.util.Map < java.lang.String , java.lang.Object > xmlRpcReturnValue = vdsServer.allocateVolume ( sdUUID , spUUID , imgGUID , volUUID , size ) ; org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc wrapper = new org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc ( xmlRpcReturnValue ) ; return wrapper ; }
Source:
public void init ( final org.ovirt.engine.ui.uicommonweb.models.AbstractErrataCountModel clickSource ) { super . init ( clickSource ) ; org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel model = modelProvider.getModel ( ) ; model.addItemsChangeListener ( new org.ovirt.engine.ui.uicompat.IEventListener < org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ( ) { @ java.lang.Override public void eventRaised ( org.ovirt.engine.ui.uicompat.Event < ? extends org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs > ev , java.lang.Object sender , org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs args ) { getView ( ) . showErrataList ( ) ; } } ) ; }

Target:
public void init ( final org.ovirt.engine.ui.uicommonweb.models.AbstractErrataCountModel clickSource ) { super . init ( clickSource ) ; org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel model = modelProvider.getModel ( ) ; model.setItemsFilter ( createFilter ( clickSource.getFilterCommand ( ) ) ) ; }
Source:
public void testGetBrickByServerIdAndDirectory ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity brick = dao.getBrickByServerIdAndDirectory ( FixturesTool.GLUSTER_BRICK_SERVER1 , FixturesTool.GLUSTER_BRICK_DIR1 ) ; org.junit.Assert.assertNotNull ( brick ) ; org.junit.Assert.assertEquals ( FixturesTool.GLUSTER_BRICK_SERVER1 , brick.getServerId ( ) ) ; org.junit.Assert.assertEquals ( FixturesTool.GLUSTER_BRICK_DIR1 , brick.getBrickDirectory ( ) ) ; }

Target:
public void testGetBrickByServerIdAndDirectory ( ) { org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity brick = dao.getBrickByServerIdAndDirectory ( FixturesTool.GLUSTER_BRICK_SERVER1 , FixturesTool.GLUSTER_BRICK_DIR1 ) ; org.junit.jupiter.api.Assertions.assertNotNull ( brick ) ; org.junit.jupiter.api.Assertions.assertEquals ( FixturesTool.GLUSTER_BRICK_SERVER1 , brick.getServerId ( ) ) ; org.junit.jupiter.api.Assertions.assertEquals ( FixturesTool.GLUSTER_BRICK_DIR1 , brick.getBrickDirectory ( ) ) ; }
Source:
protected void executeCommand ( ) { super . executeCommand ( ) ; org.ovirt.engine.core.bll.Backend.getInstance ( ) . triggerPoolMonitoringJob ( ) ; }

Target:
protected void executeCommand ( ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue currentVmsInPoolQuery = runInternalQuery ( VdcQueryType.GetAllPoolVms , new org.ovirt.engine.core.common.queries.IdQueryParameters ( org.ovirt.engine.core.bll.UpdateVmPoolWithVmsCommand.getVmPool ( ) . getVmPoolId ( ) ) ) ; java.util.List < org.ovirt.engine.core.common.businessentities.VM > poolVmsBeforeAdd = ( currentVmsInPoolQuery.getSucceeded ( ) ) ? currentVmsInPoolQuery.< java.util.List < org.ovirt.engine.core.common.businessentities.VM > > getReturnValue ( ) : null ; super . executeCommand ( ) ; if ( org.ovirt.engine.core.bll.UpdateVmPoolWithVmsCommand.getSucceeded ( ) ) { updatePoolVms ( poolVmsBeforeAdd ) ; } vmPoolMonitor.triggerPoolMonitoringJob ( ) ; }
Source:
private void updateAlerts ( ) { final org.ovirt.engine.core.common.businessentities.VDS host = org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel.getSelectedItem ( ) ; if ( host == null ) { return ; } generalModel.setHasUpgradeAlert ( host.isUpdateAvailable ( ) ) ; generalModel.setHasAnyAlert ( ) ; }

Target:
private void updateAlerts ( ) { final org.ovirt.engine.core.common.businessentities.VDS host = org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel.getSelectedItem ( ) ; if ( host == null ) { return ; } generalModel.setHasUpgradeAlert ( ( ( host.isUpdateAvailable ( ) ) && ( ( host.getStatus ( ) ) != ( org.ovirt.engine.core.common.businessentities.VDSStatus.Installing ) ) ) ) ; generalModel.setHasAnyAlert ( ) ; }
Source:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 0 , true ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.BackendBookmarksResourceTest.getModel ( 0 ) ) ; fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }

Target:
public void testUpdateNotFound ( ) throws java.lang.Exception { setUriInfo ( setUpBasicUriExpectations ( ) ) ; setUpGetEntityExpectations ( 0 , true ) ; try { resource.update ( org.ovirt.engine.api.restapi.resource.BackendBookmarksResourceTest.getModel ( 0 ) ) ; org.junit.Assert.fail ( "expected WebApplicationException" ) ; } catch ( javax.ws.rs.WebApplicationException wae ) { verifyNotFoundException ( wae ) ; } }
Source:
public void canDoActionFailsOnNullDiskInterface ( ) throws java.lang.Exception { org.ovirt.engine.core.compat.Guid storageId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.DiskImage image = new org.ovirt.engine.core.common.businessentities.DiskImage ( ) ; image.setvolumeFormat ( VolumeFormat.COW ) ; image.setVolumeType ( VolumeType.Preallocated ) ; org.ovirt.engine.core.common.action.AddDiskParameters params = new org.ovirt.engine.core.common.action.AddDiskParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , image ) ; initializeCommand ( storageId , params ) ; org.junit.Assert.assertFalse ( command.validateInputs ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( "VALIDATION.DISK_INTERFACE.NOT_NULL" ) ) ; }

Target:
public void canDoActionFailsOnNullDiskInterface ( ) throws java.lang.Exception { org.ovirt.engine.core.compat.Guid storageId = org.ovirt.engine.core.compat.Guid.newGuid ( ) ; org.ovirt.engine.core.common.businessentities.storage.DiskImage image = new org.ovirt.engine.core.common.businessentities.storage.DiskImage ( ) ; image.setvolumeFormat ( VolumeFormat.COW ) ; image.setVolumeType ( VolumeType.Preallocated ) ; org.ovirt.engine.core.common.action.AddDiskParameters params = new org.ovirt.engine.core.common.action.AddDiskParameters ( org.ovirt.engine.core.compat.Guid.newGuid ( ) , image ) ; initializeCommand ( storageId , params ) ; org.junit.Assert.assertFalse ( command.validateInputs ( ) ) ; org.junit.Assert.assertTrue ( command.getReturnValue ( ) . getCanDoActionMessages ( ) . contains ( "VALIDATION.DISK_INTERFACE.NOT_NULL" ) ) ; }
Source:
public void canDoActionFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" , null ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" , null ) ; 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 ) ) ) ) ; prepareMocks ( cmd , VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; }

Target:
public void canDoActionFailsForDifferentStorageDevice ( ) { org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice1 = getStorageDevice ( "sda" , null ) ; org.ovirt.engine.core.common.businessentities.gluster.StorageDevice storageDevice2 = getStorageDevice ( "sdb" , null ) ; 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 ) ) ) ) ; prepareMocks ( cmd , VDSStatus.Up ) ; org.junit.Assert.assertFalse ( cmd.canDoAction ( ) ) ; }
Source:
private void addStorageFormatOptions ( org.ovirt.engine.api.model.VersionCaps version , org.ovirt.engine.api.restapi.model.StorageFormat ... formats ) { if ( org.ovirt.engine.api.restapi.utils.VersionUtils.greaterOrEqual ( version , org.ovirt.engine.api.restapi.resource.BackendCapabilitiesResource.VERSION_3_0 ) ) { version.setStorageFormats ( new org.ovirt.engine.api.model.StorageFormats ( ) ) ; for ( org.ovirt.engine.api.restapi.model.StorageFormat format : formats ) { version.getStorageFormats ( ) . getStorageFormats ( ) . add ( format.value ( ) ) ; } } }

Target:
private void addStorageFormatOptions ( org.ovirt.engine.api.model.VersionCaps version , org.ovirt.engine.api.model.StorageFormat ... formats ) { version.setStorageFormats ( new org.ovirt.engine.api.model.StorageFormats ( ) ) ; for ( org.ovirt.engine.api.model.StorageFormat format : formats ) { version.getStorageFormats ( ) . getStorageFormats ( ) . add ( format.value ( ) ) ; } }
Source:
public boolean canOpenRDPConsole ( org.ovirt.engine.ui.uicommonweb.models.HasConsoleModel item ) { if ( ( item.isPool ( ) ) || ( ! ( isRDPAvailable ( ) ) ) ) return false ; if ( ( ( ( item.getAdditionalConsoleModel ( ) ) != null ) && ( item.getAdditionalConsoleModel ( ) . getConnectCommand ( ) . getIsAvailable ( ) ) ) && ( item.getAdditionalConsoleModel ( ) . getConnectCommand ( ) . getIsExecutionAllowed ( ) ) ) { return true ; } return false ; }

Target:
public boolean isSpiceProxyDefined ( org.ovirt.engine.core.common.businessentities.VM vm ) { return ( ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( ( ( java.lang.String ) ( org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getConfigValuePreConverted ( ConfigurationValues.SpiceProxyDefault ) ) ) ) ) ) || ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( vm.getVdsGroupSpiceProxy ( ) ) ) ) ) || ( ! ( org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty ( vm.getVmPoolSpiceProxy ( ) ) ) ) ; }
Source:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValueObj ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValueObj ) ) ; java.lang.Object returnValue2 = returnValue.getReturnValue ( ) ; this . allNics = ( ( java.util.List < org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface > ) ( returnValue2 ) ) ; queryNetworkAttachments ( ) ; }

Target:
public void onSuccess ( java.lang.Object model , java.lang.Object returnValueObj ) { org.ovirt.engine.core.common.queries.VdcQueryReturnValue returnValue = ( ( org.ovirt.engine.core.common.queries.VdcQueryReturnValue ) ( returnValueObj ) ) ; vfMap = returnValue.getReturnValue ( ) ; if ( ( vfMap ) == null ) { vfMap = java.util.Collections.emptyMap ( ) ; } queryFreeBonds ( ) ; }
Source:
public void testSubResourceLocator ( ) throws java.lang.Exception { java.lang.String id = java.util.UUID.nameUUIDFromBytes ( org.ovirt.engine.api.restapi.resource.BackendStatisticsResourceTest.STATISTICS [ 1 ] . getBytes ( ) ) . toString ( ) ; control.replay ( ) ; assertTrue ( ( ( collection.getStatisticSubResource ( id ) ) instanceof org.ovirt.engine.api.resource.StatisticResource ) ) ; }

Target:
public void testSubResourceLocator ( ) throws java.lang.Exception { java.lang.String id = java.util.UUID.nameUUIDFromBytes ( org.ovirt.engine.api.restapi.resource.BackendStatisticsResourceTest.STATISTICS [ 1 ] . getBytes ( ) ) . toString ( ) ; control.replay ( ) ; assertTrue ( ( ( collection.getStatisticResource ( id ) ) instanceof org.ovirt.engine.api.resource.StatisticResource ) ) ; }
Source:
public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { if ( source != null ) { return source ; } return 262144 ; }

Target:
public static void getDataCenterById ( org.ovirt.engine.ui.frontend.AsyncQuery aQuery , org.ovirt.engine.core.compat.Guid dataCenterId ) { aQuery.converterCallback = new org.ovirt.engine.ui.frontend.IAsyncConverter ( ) { @ java.lang.Override public java.lang.Object Convert ( java.lang.Object source , org.ovirt.engine.ui.frontend.AsyncQuery _asyncQuery ) { return source ; } } ; org.ovirt.engine.ui.frontend.Frontend.getInstance ( ) . runQuery ( VdcQueryType.GetStoragePoolById , new org.ovirt.engine.core.common.queries.IdQueryParameters ( dataCenterId ) . withoutRefresh ( ) , aQuery ) ; }
Source:
private org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface lookupNic ( org.ovirt.engine.core.compat.Guid nicId ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > nics = getBackendCollection ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface.class , VdcQueryType.GetTemplateInterfacesByTemplateId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( templateId ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface nic : nics ) { if ( java.util.Objects.equals ( nic.getId ( ) , nicId ) ) { return nic ; } } return null ; }

Target:
private org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface lookupNic ( org.ovirt.engine.core.compat.Guid nicId ) { java.util.List < org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface > nics = getBackendCollection ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface.class , QueryType.GetTemplateInterfacesByTemplateId , new org.ovirt.engine.core.common.queries.IdQueryParameters ( templateId ) ) ; for ( org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface nic : nics ) { if ( java.util.Objects.equals ( nic.getId ( ) , nicId ) ) { return nic ; } } return null ; }