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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations