use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class GetErrataCountsForHostQueryTest method noAvailableHostErrata.
@Test
public void noAvailableHostErrata() {
setupToReportErrata(Collections.emptyList());
getQuery().executeQueryCommand();
assertNotNull(getQuery().getQueryReturnValue().getReturnValue());
ErrataCounts returnValue = getQuery().getQueryReturnValue().getReturnValue();
for (ErrataType type : ErrataType.values()) {
assertEquals(0, returnValue.getCountByType(type));
}
}
use of org.ovirt.engine.core.common.businessentities.ErrataCounts 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());
}
Aggregations