use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class BackendHostKatelloErrataResource method list.
@Override
public KatelloErrata list() {
ErrataData errataData = null;
try {
QueryReturnValue returnValue = runQuery(QueryType.GetErrataForHost, new GetErrataCountsParameters(asGuid(hostId)));
if (!returnValue.getSucceeded()) {
backendFailure(returnValue.getExceptionString());
}
errataData = returnValue.getReturnValue();
} catch (Exception e) {
handleError(e, false);
}
if (errataData == null) {
return new KatelloErrata();
}
return mapCollection(errataData.getErrata());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class GetErrataCountsForHostQueryTest method setupToReportErrata.
@SuppressWarnings("unchecked")
private void setupToReportErrata(List<Erratum> errata) {
when(host.getHostProviderId()).thenReturn(mock(Guid.class));
when(vdsStaticDao.get(any())).thenReturn(host);
when(providerDao.get(any())).thenReturn(mock(Provider.class));
doReturn(providerProxy).when(getQuery()).getHostProviderProxy(any());
ErrataData errataData = mock(ErrataData.class);
ErrataCounts errataCounts = mock(ErrataCounts.class);
when(errataData.getErrataCounts()).thenReturn(errataCounts);
Stream.of(ErrataType.values()).forEach(type -> when(errataCounts.getCountByType(type)).thenReturn((int) errata.stream().filter(erratum -> erratum.getType() == type).count()));
doReturn(errataData).when(providerProxy).getErrataForHost(any(), any());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class GetErrataForHostQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VdsStatic host = hostStaticDao.get(getParameters().getId());
if (host == null || host.getHostProviderId() == null) {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
return;
}
Provider<?> provider = providerDao.get(host.getHostProviderId());
if (provider != null) {
HostProviderProxy proxy = providerProxyFactory.create(provider);
ErrataData errataForHost = proxy.getErrataForHost(host.getHostName(), getParameters().getErrataFilter());
getQueryReturnValue().setReturnValue(errataForHost);
} else {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
}
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class GetErrataForVmQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VM vm = vmDao.get(getParameters().getId());
if (vm == null || vm.getDynamicData().getVmHost() == null) {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
return;
}
Provider<?> provider = providerDao.get(vm.getProviderId());
if (provider != null) {
HostProviderProxy proxy = providerProxyFactory.create(provider);
ErrataData errataForVm = proxy.getErrataForHost(vm.getDynamicData().getVmHost(), getParameters().getErrataFilter());
getQueryReturnValue().setReturnValue(errataForVm);
} else {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
}
}
Aggregations