use of org.ovirt.engine.core.common.queries.QueryReturnValue 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.QueryReturnValue 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.QueryReturnValue 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);
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class AbstractGwtDynamicHostPageServletTest method stubGetConfigurationValuePublicQuery.
void stubGetConfigurationValuePublicQuery() {
QueryReturnValue returnValue = new QueryReturnValue();
returnValue.setSucceeded(true);
// $NON-NLS-1$
returnValue.setReturnValue("1.2.3");
when(mockBackend.runPublicQuery(eq(QueryType.GetConfigurationValue), argThat(configValueParams(ConfigValues.ProductRPMVersion)))).thenReturn(returnValue);
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class ClusterListModel method fetchAndImportClusterHosts.
private void fetchAndImportClusterHosts(final ClusterModel clusterModel) {
getWindow().startProgress();
AsyncQuery<QueryReturnValue> aQuery = new AsyncQuery<>(result -> {
getWindow().stopProgress();
QueryReturnValue returnValue = result;
if (returnValue == null) {
onEmptyGlusterHosts(clusterModel);
return;
} else if (!returnValue.getSucceeded()) {
clusterModel.setMessage(Frontend.getInstance().getAppErrorsTranslator().translateErrorTextSingle(returnValue.getExceptionString()));
return;
}
Map<String, String> hostMap = returnValue.getReturnValue();
if (hostMap == null) {
onEmptyGlusterHosts(clusterModel);
return;
}
if (hostMap.containsValue(null) || hostMap.containsValue("")) {
// $NON-NLS-1$
onGlusterHostsWithoutFingerprint(hostMap, clusterModel);
return;
}
ArrayList<EntityModel<HostDetailModel>> list = new ArrayList<>();
for (Map.Entry<String, String> host : hostMap.entrySet()) {
HostDetailModel hostModel = new HostDetailModel(host.getKey(), host.getValue());
hostModel.setName(host.getKey());
// $NON-NLS-1$
hostModel.setPassword("");
EntityModel<HostDetailModel> entityModel = new EntityModel<>(hostModel);
list.add(entityModel);
}
importClusterHosts(clusterModel, list);
});
aQuery.setHandleFailure(true);
AsyncDataProvider.getInstance().getGlusterHosts(aQuery, clusterModel.getGlusterHostAddress().getEntity(), clusterModel.getGlusterHostPassword().getEntity(), clusterModel.getGlusterHostFingerprint().getEntity());
}
Aggregations