Search in sources :

Example 11 with QueryParametersBase

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

the class GWTRPCCommunicationProviderTest method testTransmitOperationList_oneQuery_failure.

@Test
public void testTransmitOperationList_oneQuery_failure() {
    List<VdcOperation<?, ?>> testList = new ArrayList<>();
    QueryParametersBase testParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackSingle1);
    testList.add(testOperation1);
    testProvider.transmitOperationList(testList);
    verify(mockService).runQuery(eq(QueryType.Search), eq(testParameters), queryCallback.capture());
    // $NON-NLS-1$
    Exception testException = new Exception("This is an exception");
    queryCallback.getValue().onFailure(testException);
    verify(mockOperationCallbackSingle1).onFailure(testOperation1, 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 12 with QueryParametersBase

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

the class GWTRPCCommunicationProviderTest method testTransmitOperationQuery_success.

@Test
public void testTransmitOperationQuery_success() {
    QueryParametersBase testParameters = new QueryParametersBase();
    final QueryReturnValue testResult = new QueryReturnValue();
    final List<VdcOperation<QueryType, QueryParametersBase>> operationList = new ArrayList<>();
    final VdcOperation<QueryType, QueryParametersBase> testOperation = new VdcOperation<>(QueryType.Search, testParameters, new VdcOperationCallback<VdcOperation<QueryType, QueryParametersBase>, QueryReturnValue>() {

        @Override
        public void onSuccess(VdcOperation<QueryType, QueryParametersBase> operation, QueryReturnValue result) {
            // $NON-NLS-1$
            assertEquals("Test results should match", testResult, result);
            // $NON-NLS-1$
            assertEquals("Operations should match", operationList.get(0), operation);
        }

        @Override
        public void onFailure(VdcOperation<QueryType, QueryParametersBase> operation, Throwable caught) {
            // $NON-NLS-1$
            fail("Should not get here");
        }
    });
    operationList.add(testOperation);
    testProvider.transmitOperation(testOperation);
    verify(mockService).runQuery(eq(QueryType.Search), eq(testParameters), queryCallback.capture());
    queryCallback.getValue().onSuccess(testResult);
}
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)

Example 13 with QueryParametersBase

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

the class GWTRPCCommunicationProviderTest method testTransmitOperationList_oneQuery_success.

@Test
public void testTransmitOperationList_oneQuery_success() {
    List<VdcOperation<?, ?>> testList = new ArrayList<>();
    QueryParametersBase testParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testParameters, mockOperationCallbackSingle1);
    testList.add(testOperation1);
    testProvider.transmitOperationList(testList);
    verify(mockService).runQuery(eq(QueryType.Search), eq(testParameters), queryCallback.capture());
    QueryReturnValue testResult = new QueryReturnValue();
    queryCallback.getValue().onSuccess(testResult);
    verify(mockOperationCallbackSingle1).onSuccess(testOperation1, testResult);
}
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)

Example 14 with QueryParametersBase

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

the class GWTRPCCommunicationProviderTest method testTransmitPublicOperationList_success.

@Test
public void testTransmitPublicOperationList_success() {
    QueryParametersBase testQueryParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testQueryParameters, true, false, mockOperationCallbackSingle1);
    List<VdcOperation<?, ?>> operationList = new ArrayList<>();
    operationList.add(testOperation1);
    testProvider.transmitOperationList(operationList);
    verify(mockService).runPublicQuery(eq(QueryType.Search), eq(testQueryParameters), queryCallback.capture());
    QueryReturnValue testQueryResult = new QueryReturnValue();
    queryCallback.getValue().onSuccess(testQueryResult);
    verify(mockOperationCallbackSingle1).onSuccess(testOperation1, testQueryResult);
}
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)

Example 15 with QueryParametersBase

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

the class GWTRPCCommunicationProviderTest method testTransmitPublicOperationList_two_public_success.

@Test
public void testTransmitPublicOperationList_two_public_success() {
    QueryParametersBase testQueryParameters = new QueryParametersBase();
    VdcOperation<QueryType, QueryParametersBase> testOperation1 = new VdcOperation<>(QueryType.Search, testQueryParameters, true, false, mockOperationCallbackSingle1);
    VdcOperation<QueryType, QueryParametersBase> testOperation2 = new VdcOperation<>(QueryType.GetConfigurationValues, testQueryParameters, true, false, mockOperationCallbackSingle2);
    List<VdcOperation<?, ?>> operationList = new ArrayList<>();
    operationList.add(testOperation1);
    operationList.add(testOperation2);
    testProvider.transmitOperationList(operationList);
    verify(mockService).runPublicQuery(eq(QueryType.Search), eq(testQueryParameters), queryCallback.capture());
    QueryReturnValue testQueryResult = new QueryReturnValue();
    queryCallback.getValue().onSuccess(testQueryResult);
    verify(mockOperationCallbackSingle1).onSuccess(testOperation1, testQueryResult);
    verify(mockService).runPublicQuery(eq(QueryType.GetConfigurationValues), eq(testQueryParameters), queryCallback.capture());
    testQueryResult = new QueryReturnValue();
    queryCallback.getValue().onSuccess(testQueryResult);
    verify(mockOperationCallbackSingle2).onSuccess(testOperation2, testQueryResult);
}
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

QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)89 ArrayList (java.util.ArrayList)41 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)40 QueryType (org.ovirt.engine.core.common.queries.QueryType)37 Test (org.junit.Test)33 StorageServerConnectionQueryParametersBase (org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)22 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)18 List (java.util.List)15 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)15 Guid (org.ovirt.engine.core.compat.Guid)13 HashMap (java.util.HashMap)11 StatusCodeException (com.google.gwt.user.client.rpc.StatusCodeException)9 HashSet (java.util.HashSet)7 Map (java.util.Map)6 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 Frontend (org.ovirt.engine.ui.frontend.Frontend)6 Collection (java.util.Collection)5 Quota (org.ovirt.engine.core.common.businessentities.Quota)5 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)5 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5