Search in sources :

Example 21 with QueryType

use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.

the class AsyncDataProvider method initCpuMap.

private void initCpuMap() {
    cpuMap = new HashMap<>();
    final List<QueryType> queryTypes = new ArrayList<>();
    final List<QueryParametersBase> queryParams = new ArrayList<>();
    for (Version version : Version.ALL) {
        queryTypes.add(QueryType.GetAllServerCpuList);
        queryParams.add(new GetAllServerCpuListParameters(version));
    }
    final IFrontendMultipleQueryAsyncCallback callback = result -> {
        for (int i = 0; i < result.getReturnValues().size(); i++) {
            final List<ServerCpu> cpus = result.getReturnValues().get(i).getReturnValue();
            final Version version = ((GetAllServerCpuListParameters) result.getParameters().get(i)).getVersion();
            initCpuMapForVersion(version, cpus);
        }
    };
    Frontend.getInstance().runMultipleQueries(queryTypes, queryParams, callback);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) BusinessEntity(org.ovirt.engine.core.common.businessentities.BusinessEntity) ServiceType(org.ovirt.engine.core.common.businessentities.gluster.ServiceType) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Map(java.util.Map) VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) ProfileEntry(org.ovirt.engine.core.aaa.ProfileEntry) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) ActionUtils(org.ovirt.engine.core.common.ActionUtils) RefObject(org.ovirt.engine.core.compat.RefObject) SetupNetworksBondModel(org.ovirt.engine.ui.uicommonweb.models.hosts.SetupNetworksBondModel) GlusterVolumeQueriesParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeQueriesParameters) StringHelper(org.ovirt.engine.core.compat.StringHelper) NetworkQoSModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkQoSModel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) GlusterParameters(org.ovirt.engine.core.common.queries.gluster.GlusterParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GetStorageDomainsByConnectionParameters(org.ovirt.engine.core.common.queries.GetStorageDomainsByConnectionParameters) QueryType(org.ovirt.engine.core.common.queries.QueryType) LoginModel(org.ovirt.engine.ui.uicommonweb.models.LoginModel) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) OsQueryParameters(org.ovirt.engine.core.common.queries.OsQueryParameters) GlusterClusterService(org.ovirt.engine.core.common.businessentities.gluster.GlusterClusterService) GlusterVolumeSnapshotSchedule(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Pair(org.ovirt.engine.core.common.utils.Pair) ExternalComputeResource(org.ovirt.engine.core.common.businessentities.ExternalComputeResource) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) IdsQueryParameters(org.ovirt.engine.core.common.queries.IdsQueryParameters) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Quota(org.ovirt.engine.core.common.businessentities.Quota) GlusterHookQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters) VmCommonUtils(org.ovirt.engine.core.common.utils.VmCommonUtils) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) VM(org.ovirt.engine.core.common.businessentities.VM) QosType(org.ovirt.engine.core.common.businessentities.qos.QosType) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) GetExistingStorageDomainListParameters(org.ovirt.engine.core.common.queries.GetExistingStorageDomainListParameters) GlusterStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.GlusterStorageModel) GlusterVolumeRemoveBricksQueriesParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksQueriesParameters) QuotaComparator(org.ovirt.engine.ui.uicommonweb.comparators.QuotaComparator) SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel) GetSupportedCpuListParameters(org.ovirt.engine.core.common.queries.GetSupportedCpuListParameters) SortedSet(java.util.SortedSet) GetClusterFeaturesByVersionAndCategoryParameters(org.ovirt.engine.core.common.queries.GetClusterFeaturesByVersionAndCategoryParameters) GetVmsFromExternalProviderQueryParameters(org.ovirt.engine.core.common.queries.GetVmsFromExternalProviderQueryParameters) GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) KeyValuePairCompat(org.ovirt.engine.core.compat.KeyValuePairCompat) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) Collection(java.util.Collection) WanColorDepth(org.ovirt.engine.core.common.console.ConsoleOptions.WanColorDepth) Collectors(java.util.stream.Collectors) TagsType(org.ovirt.engine.core.common.businessentities.TagsType) GetPermittedStorageDomainsByStoragePoolIdParameters(org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) GetTagsByUserGroupIdParameters(org.ovirt.engine.core.common.queries.GetTagsByUserGroupIdParameters) Entry(java.util.Map.Entry) Converter(org.ovirt.engine.ui.frontend.Converter) VdcEventNotificationUtils(org.ovirt.engine.core.common.VdcEventNotificationUtils) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) GetAllAttachableDisksForVmQueryParameters(org.ovirt.engine.core.common.queries.GetAllAttachableDisksForVmQueryParameters) IntegerCompat(org.ovirt.engine.core.compat.IntegerCompat) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ImportIscsiStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.ImportIscsiStorageModel) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) GetAllServerCpuListParameters(org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) GetTagsByUserIdParameters(org.ovirt.engine.core.common.queries.GetTagsByUserIdParameters) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) CinderVolumeType(org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType) GetStoragePoolsByClusterServiceParameters(org.ovirt.engine.core.common.queries.GetStoragePoolsByClusterServiceParameters) VmTemplateStatus(org.ovirt.engine.core.common.businessentities.VmTemplateStatus) GetVmChangedFieldsForNextRunParameters(org.ovirt.engine.core.common.queries.GetVmChangedFieldsForNextRunParameters) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) ConfigurationType(org.ovirt.engine.core.common.businessentities.ConfigurationType) ClusterEditWarnings(org.ovirt.engine.core.common.businessentities.ClusterEditWarnings) GetHostListFromExternalProviderParameters(org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters) GetLunsByVgIdParameters(org.ovirt.engine.core.common.queries.GetLunsByVgIdParameters) Role(org.ovirt.engine.core.common.businessentities.Role) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Comparator(java.util.Comparator) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Arrays(java.util.Arrays) GetConnectionsByDataCenterAndStorageTypeParameters(org.ovirt.engine.core.common.queries.GetConnectionsByDataCenterAndStorageTypeParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider) GetDataCentersWithPermittedActionOnClustersParameters(org.ovirt.engine.core.common.queries.GetDataCentersWithPermittedActionOnClustersParameters) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) HostDeviceView(org.ovirt.engine.core.common.businessentities.HostDeviceView) GetVmTemplateParameters(org.ovirt.engine.core.common.queries.GetVmTemplateParameters) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Tags(org.ovirt.engine.core.common.businessentities.Tags) GlusterVolumeGeoRepEligibilityParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeGeoRepEligibilityParameters) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters) VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) EventNotificationEntity(org.ovirt.engine.core.common.EventNotificationEntity) GetVmTemplatesFromStorageDomainParameters(org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) GlusterServiceQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters) PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Label(org.ovirt.engine.core.common.businessentities.Label) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) VmWithStatusForExclusiveLock(org.ovirt.engine.core.common.businessentities.VmWithStatusForExclusiveLock) ClusterEditParameters(org.ovirt.engine.core.common.queries.ClusterEditParameters) BondMode(org.ovirt.engine.core.common.businessentities.network.BondMode) LibvirtSecretUsageType(org.ovirt.engine.core.common.businessentities.storage.LibvirtSecretUsageType) VmIconIdSizePair(org.ovirt.engine.core.common.queries.VmIconIdSizePair) GlusterGeoRepNonEligibilityReason(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason) GetStorageDomainDefaultWipeAfterDeleteParameters(org.ovirt.engine.core.common.queries.GetStorageDomainDefaultWipeAfterDeleteParameters) Guid(org.ovirt.engine.core.compat.Guid) GlusterServersQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterServersQueryParameters) TreeSet(java.util.TreeSet) OsRepositoryVerb(org.ovirt.engine.core.common.queries.OsQueryParameters.OsRepositoryVerb) ArrayList(java.util.ArrayList) ArchCapabilitiesVerb(org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters.ArchCapabilitiesVerb) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Permission(org.ovirt.engine.core.common.businessentities.Permission) VmHostDevice(org.ovirt.engine.core.common.businessentities.VmHostDevice) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) ImportFcpStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.ImportFcpStorageModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) CertificateInfo(org.ovirt.engine.core.common.businessentities.CertificateInfo) Nameable(org.ovirt.engine.core.common.businessentities.Nameable) NumaTuneMode(org.ovirt.engine.core.common.businessentities.NumaTuneMode) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) VmInterfaceType(org.ovirt.engine.core.common.businessentities.network.VmInterfaceType) GetAgentFenceOptionsQueryParameters(org.ovirt.engine.core.common.queries.GetAgentFenceOptionsQueryParameters) GetValidHostsForVmsParameters(org.ovirt.engine.core.common.queries.GetValidHostsForVmsParameters) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) ServerParameters(org.ovirt.engine.core.common.queries.ServerParameters) NetworkFilterParameterModel(org.ovirt.engine.ui.uicommonweb.models.vms.NetworkFilterParameterModel) List(java.util.List) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) GetVmFromConfigurationQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromConfigurationQueryParameters) GetVmFromOvaQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromOvaQueryParameters) AuditLogType(org.ovirt.engine.core.common.AuditLogType) OsValueAutoCompleter(org.ovirt.engine.core.searchbackend.OsValueAutoCompleter) IFrontendMultipleQueryAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback) GlusterHookContentQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) WanDisableEffects(org.ovirt.engine.core.common.console.ConsoleOptions.WanDisableEffects) IscsiStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IscsiStorageModel) HashMap(java.util.HashMap) ArchCapabilitiesParameters(org.ovirt.engine.core.common.queries.ArchCapabilitiesParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) SimpleDependencyInjector(org.ovirt.engine.core.common.utils.SimpleDependencyInjector) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) GetTagsByVdsIdParameters(org.ovirt.engine.core.common.queries.GetTagsByVdsIdParameters) StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) GetTagsByVmIdParameters(org.ovirt.engine.core.common.queries.GetTagsByVmIdParameters) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Network(org.ovirt.engine.core.common.businessentities.network.Network) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) GetHostsForStorageOperationParameters(org.ovirt.engine.core.common.queries.GetHostsForStorageOperationParameters) FcpStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.FcpStorageModel) Iterator(java.util.Iterator) GlusterVolumeAdvancedDetailsParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters) ValidateVmMacsParameters(org.ovirt.engine.core.common.queries.ValidateVmMacsParameters) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) GetEntitiesWithPermittedActionParameters(org.ovirt.engine.core.common.queries.GetEntitiesWithPermittedActionParameters) AddedGlusterServersParameters(org.ovirt.engine.core.common.queries.gluster.AddedGlusterServersParameters) Version(org.ovirt.engine.core.compat.Version) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) ArrayList(java.util.ArrayList) GetAllServerCpuListParameters(org.ovirt.engine.core.common.queries.GetAllServerCpuListParameters) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) IFrontendMultipleQueryAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback) ArrayList(java.util.ArrayList) List(java.util.List) QueryType(org.ovirt.engine.core.common.queries.QueryType)

Example 22 with QueryType

use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.

the class AsyncDataProvider method updateVDSInterfaceList.

public void updateVDSInterfaceList(List<VDS> vdsList, Runnable callback) {
    if (vdsList != null && !vdsList.isEmpty()) {
        List<QueryType> types = new ArrayList<>();
        List<QueryParametersBase> ids = new ArrayList<>();
        vdsList.stream().forEach(vds -> {
            types.add(QueryType.GetVdsInterfacesByVdsId);
            ids.add(new IdQueryParameters(vds.getId()));
        });
        Frontend.getInstance().runMultipleQueries(types, ids, result -> {
            List<QueryReturnValue> values = result.getReturnValues();
            for (int i = 0; i < vdsList.size(); i++) {
                QueryReturnValue interfaceQueryValue = values.get(i);
                if (interfaceQueryValue.getReturnValue() != null) {
                    vdsList.get(i).getInterfaces().addAll(interfaceQueryValue.getReturnValue());
                }
            }
            callback.run();
        });
    } else {
        callback.run();
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) QueryType(org.ovirt.engine.core.common.queries.QueryType)

Example 23 with QueryType

use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.

the class GWTRPCCommunicationProviderTest method testMissingXsrfToken.

@SuppressWarnings("unchecked")
@Test
public void testMissingXsrfToken() {
    // Remove token so there should be a request for it.
    mockXsrfRpcRequestBuilder.setXsrfToken(null);
    QueryParametersBase testParameters = new QueryParametersBase();
    final List<VdcOperation<QueryType, QueryParametersBase>> operationList = new ArrayList<>();
    final VdcOperation<QueryType, QueryParametersBase> testOperation = new VdcOperation<>(QueryType.Search, testParameters, null);
    operationList.add(testOperation);
    testProvider.transmitOperation(testOperation);
    verify(mockXsrfService).getNewXsrfToken((AsyncCallback<XsrfToken>) any());
}
Also used : ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryType(org.ovirt.engine.core.common.queries.QueryType) XsrfToken(com.google.gwt.user.client.rpc.XsrfToken) Test(org.junit.Test)

Example 24 with QueryType

use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.

the class GWTRPCCommunicationProviderTest method testTransmitOperationList_multipleQuery_different_callback_failure.

@Test
public void testTransmitOperationList_multipleQuery_different_callback_failure() {
    List<VdcOperation<?, ?>> testList = new ArrayList<>();
    List<VdcOperation<?, ?>> operation1List = new ArrayList<>();
    List<VdcOperation<?, ?>> operation2List = new ArrayList<>();
    QueryParametersBase testParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackList1);
    VdcOperation<QueryType, QueryParametersBase> testOperation2 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackList2);
    testList.add(testOperation1);
    testList.add(testOperation2);
    operation1List.add(testOperation1);
    operation2List.add(testOperation2);
    List<QueryParametersBase> testParameterList = createQueryParameterList(testParameters, 2);
    List<QueryType> testQueryList = createQueryList(QueryType.Search, 2);
    testProvider.transmitOperationList(testList);
    verify(mockService).runMultipleQueries(eq((ArrayList<QueryType>) testQueryList), (ArrayList<QueryParametersBase>) eq(testParameterList), queryCallbackList.capture());
    // $NON-NLS-1$
    Exception testException = new Exception("This is an exception");
    queryCallbackList.getValue().onFailure(testException);
    verify(mockOperationCallbackList1).onFailure(eq(operation1List), eq(testException));
    verify(mockOperationCallbackList2).onFailure(eq(operation2List), eq(testException));
}
Also used : ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryType(org.ovirt.engine.core.common.queries.QueryType) Test(org.junit.Test)

Example 25 with QueryType

use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.

the class GWTRPCCommunicationProviderTest method testTransmitOperationList_multipleQuery_different_callback_success.

@Test
public void testTransmitOperationList_multipleQuery_different_callback_success() {
    List<VdcOperation<?, ?>> testList = new ArrayList<>();
    List<VdcOperation<?, ?>> operation1List = new ArrayList<>();
    List<VdcOperation<?, ?>> operation2List = new ArrayList<>();
    QueryParametersBase testParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackList1);
    VdcOperation<QueryType, QueryParametersBase> testOperation2 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackList2);
    testList.add(testOperation1);
    testList.add(testOperation2);
    operation1List.add(testOperation1);
    operation2List.add(testOperation2);
    List<QueryParametersBase> testParameterList = createQueryParameterList(testParameters, 2);
    List<QueryType> testQueryList = createQueryList(QueryType.Search, 2);
    testProvider.transmitOperationList(testList);
    QueryReturnValue returnValue = new QueryReturnValue();
    List<QueryReturnValue> resultList = createQueryResultList(returnValue, 2);
    List<QueryReturnValue> return1List = createQueryResultList(returnValue, 1);
    List<QueryReturnValue> return2List = createQueryResultList(returnValue, 1);
    verify(mockService).runMultipleQueries(eq((ArrayList<QueryType>) testQueryList), (ArrayList<QueryParametersBase>) eq(testParameterList), queryCallbackList.capture());
    queryCallbackList.getValue().onSuccess((ArrayList<QueryReturnValue>) resultList);
    verify(mockOperationCallbackList1).onSuccess(eq(operation1List), eq(return1List));
    verify(mockOperationCallbackList2).onSuccess(eq(operation2List), eq(return2List));
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryType(org.ovirt.engine.core.common.queries.QueryType) Test(org.junit.Test)

Aggregations

QueryType (org.ovirt.engine.core.common.queries.QueryType)39 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)33 ArrayList (java.util.ArrayList)32 Test (org.junit.Test)22 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)21 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)15 Guid (org.ovirt.engine.core.compat.Guid)9 List (java.util.List)8 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)6 HashMap (java.util.HashMap)5 ActionType (org.ovirt.engine.core.common.action.ActionType)5 Quota (org.ovirt.engine.core.common.businessentities.Quota)5 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)5 VM (org.ovirt.engine.core.common.businessentities.VM)4 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)4 StatusCodeException (com.google.gwt.user.client.rpc.StatusCodeException)3 Map (java.util.Map)3 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)3 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3